eolymp
bolt
Try our new interface for solving problems
Problems

Garden beds

Garden beds

Rectangular garden of width n and length m is divided into squares of side 1. At this place the beds are dug up. Beds is a collection of squares, satisfying the following conditions:

  • Out of every square of the bed its possible to access any other square of the same bed, successively moving along the bed from square to square through their common side;
  • Any two beds do not intersect and do not touch each other either vertically or horizontally sides of the squares (the angle's contact of the beds squares is allowed).

Count the number of beds at the garden plot.

Input

First line contains numbers n and m (1n, m200). It is followed by n lines of m characters. The # symbol denotes the territory of beds, the point corresponds to free territory. There is no any other character in the input.

Output

Print the number of beds at the garden plot.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 10
##......#.
.#..#...#.
.###....#.
..##....#.
........#.
Output example #1
3