HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Camp. Turkey > problem:


Cities and roads

Volume problems

• Maximum Sum 2
• Gifts of Santa Claus
• Rectangles on a plane
• Permutations
• Reverse permutation
• Nameplates
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Cities and roads
• Cycle detection
• Diameter of graph
• Divisors count
• GCD of ones
• Prime numbers
• Set cover problem
• Shopping
• Corridor

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/1000/1000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

Given N cities and some of them are connected with roads. Calculate number of roads.

Input

There is a single integer N on the first line (0 ≤ N ≤ 100). There are N integers 1 or 0 on each of N next lines. Where (i, j) = 1 if cities i and j are connected and 0 otherwise.

Output

Write number of roads.

Example

stdin stdout

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

3

Для отправки решений необходимо выполнить вход.

www.contester.ru