spoj#PLUSEVI. How Many Plusses
How Many Plusses
Mirko is a strange boy so he has written down a square matrix full of ones and zeroes. Now he is interested in how many plusses there are in his matrix.
A plus is a square such that its side has an odd length greater than 1 and all of its cells are zero, except for the middle row and the middle column: they must be full of ones. For example, in the matrix below there are two plusses, one inside the other:
00100
00100
11111
00100
00100
Input
In the first line there is an integer N ≤ 2000, dimenzion of the square matrix.
The next N lines are the rows of the matrix.
Output
Print the number of plusses appearing in the matrix.
Example
Input: 8
00010000
00010000
00010000
11111111
00010000
00010010
00010111
00010010
Output: 3