The inhabitants of BitVille and ByteVille are engaged in a periodic wars. Last month, BitVille successfully launched and orbited a spy telescope called the Hobble Scope. The purpose of the Hobble Scope was to count the number of Byte Warriors in ByteVille. The Hobble Scope, however, developed two problems because of poor quality control during its construction. Its primary lens was contaminated with bugs which block part of each image, and its focusing mechanism malfunctioned so that images vary in size and sharpness.
The computer programmers, who must rectify the Hobble Scope's problems are being held hostage in a The Byte Inn. The Hobble Scope's flawed images are stored by pixel in a file called Hobble.im
Each image is square and each pixel or cell contains either a 0 or a 1. The unique Hobble Scope Camera (HSC) records at each pixel location a 1 if part or all of a Byte Warrior is present and a 0 if any other object, including a bug, is visible. The programmers must assume the following:
Input
The first line of the input contains N, the dimension of the image. It is followed by N rows, each line containing N digits. Each digit is either 0 or 1.
Output
The output should be a single number specifying the number of unique Byte Warriors in the image.
Constraint:
1 <= N <= 500