Category

Similar Problems

0780. Cell removal

Time limit : 2000 ms
Memory limit : 64 mb

From a rectangular sheet of paper tartan (N rows, M columns) have removed some of the cells. How many pieces fall apart the rest of the sheet? Two cells do not break if they have a common side.

Input

 In the first row are the number of N and M, the following N lines - on M symbols. If the cell had not been cut, this corresponds to the # sign, if cut - a point. 1 ≤ NM ≤  1000. There is at least one # in input.

Output

 Print a single number – the answer to the problem.

Samples

Input

Output

1

4 8

#.##.#.#

......##

#.###.##

##.##.##

6

 

Tayyorladi: Azat Yusupov
Text from: e-olimp.com