Time

13:26:02
23 May 2012
Version for print

Cities and roads

   In the galaxy of "Milky Way" on the planet "Neptune" has N cities, some of which are connected by roads. Emperor "Maximus" Galaxy "Milky Way" has decided to make an inventory of roads on the planet "Neptune". But as it turned out he was not good at math, so he asks you to count the number of roads.


Specifications

   Input

   The first line contains the number N (0N100). In the next N lines contain the N numbers, each of which is the identity or zero. Moreover, if the position (i, j) square matrix is one, then the i-th and j-th city are connected by roads, and if zero, it is not connected.

   Output

   Derive a single number - the number of roads on the planet "Neptune".


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 3% 221/229
Classes: Graph theory

Example

Example input

5
0 1 0 0 0 
1 0 1 1 0 
0 1 0 0 0 
0 1 0 0 0 
0 0 0 0 0

Example output

3


← Øàáëîí è ñëîâî Problems Traffic lights →