Given a maze, you are to tell the number of partitions in it.
Input
The first line is an integer N (2 <= N <= 3000), the size of the maze.
The next N lines each has N 0-and-1's, 1 for an obstacle and 0 for an unoccupied space.
Two unoccupied spaces are in the same partition if:
They are adjacent (above, below, left/right to,but not diagonally), or
They are both connected with another unoccupied space.
Output
One number on a line - the number of partitions.
Sample Input
2
0 1
1 0
Sample Output
2