Military base
A spy satellite has captured an image of a top-secret military base, believed to belong to an adversary. This base is situated in Antarctica, and all its structures are made from ice cubes, appearing as squares in the photograph. The walls of these structures are aligned parallel to the edges of the photograph. No two buildings are adjacent horizontally, vertically, or diagonally, ensuring there is always at least one pixel of empty space between them. Each building is fully contained within the photograph. Your task is to determine the total number of buildings present in the base.
Input
The first line contains the integers N and M (1 ≤ N, M ≤ 20), representing the vertical and horizontal dimensions of the photograph in pixels. The next N lines each contain M characters: the character "." denotes an empty space, while "#" represents a part of a building.
Output
Output the total number of buildings on the base.