eolymp
bolt
Try our new interface for solving problems
Problems

Space Exploration

Space Exploration

Time limit 1 second
Memory limit 128 MiB

Farmer John's cows have finally blasted off from earth and are now floating around space in their Moocraft. The cows want to reach their fiery kin on Jupiter's moon of Io, but to do this they must first navigate through the dangerous asteroid belt.

Bessie is piloting the craft through this treacherous n \cdot n sector of space. Asteroids in this sector comprise some number of 1 \cdot 1 squares of space-rock connected along their edges (two squares sharing only a corner count as two distinct asteroids). Please help Bessie maneuver through the field by counting the number of distinct asteroids in the entire sector.

Consider the 10 \cdot 10 space shown below on the left. The "*" represent asteroid chunks, and each "." represents a .vast void of empty space. The diagram on the right shows an arbitrary numbering applied to the asteroids.

...**.....     ...11.....
.*........     .2........
......*...    ......3...
...*..*...     ...3..3...
..*****...    ..33333...
...*......    ...3......
....***...    ....444...
.*..***...    .5..444...
.....*...*    .....4...6
..*.......    ..7.......

It's easy to see there are 7 asteroids in this sector.

Input data

The first line contains integer n~(1 \le n \le 1000). Starting from the second line the (i + 1)-th line contains i-th row of the asteroid field: n characters.

Output data

Print the number of asteroids in the field.

Examples

Input example #1
10
...**.....
.*........
......*...
...*..*...
..*****...
...*......
....***...
.*..***...
.....*...*
..*.......
Output example #1
7
Source 2011 USACO January, Bronze