CSES - Counting Rooms
  • Time limit: 1.00 s
  • Memory limit: 512 MB

You are given a map of a building, and your task is to count the number of its rooms. The size of the map is n×mn \times m squares, and each square is either floor or wall. You can walk left, right, up, and down through the floor squares.

Input

The first input line has two integers nn and mm: the height and width of the map.

Then there are nn lines of mm characters describing the map. Each character is either . (floor) or # (wall).

Output

Print one integer: the number of rooms.

Constraints

  • 1n,m10001 \le n,m \le 1000

Example

Input:

5 8
########
#..#...#
####.#.#
#..#...#
########

Output:

3