eolymp
bolt
Try our new interface for solving problems
Problems

Cities and roads

Cities and roads

In the galaxy of "Milky Way" on the planet "Neptune" there are $n$ cities, some of them are connected by roads. Emperor "Maximus" of 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. \InputFile The first line contains the number $n~(0 \le n \le 100)$. Each of the next $n$ lines contains $n$ numbers, each of which is one or zero. Moreover, if the position $(i, j)$ of square matrix is one, then the $i$-th and $j$-th city are connected by road, and if zero, it is not connected. \OutputFile Print the number of roads on "Neptune" planet. \includegraphics{https://static.e-olymp.com/content/12/12b9f05204852791120b7e675644657953915f2f.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
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
Output example #1
3