ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Camp. Turkey > задача:


Cities and roads

Задачи сборника

• A+B
• Herons
• Workshop
• City Tour
• A Palace with Many Columns
• Nameplates
• Cycle detection
• Cities and roads
• Adjacency matrix to edges list
• Edges list to Adjacency matrix
• Permutations
• Reverse permutation
• Divisors count
• GCD of ones
• Set cover problem
• Subsets

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 1000/1000/1000/1000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

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