Flight Routes
시간 제한2초메모리 제한1024 MB
모든 도시 쌍 i<j에 대해 i에서 j로 가는 항공 경로 개수의 홀짝이 주어질 때, 직항편의 개수를 구한다.
문제
Bessie recently discovered that her favorite pop artist, Elsie Swift, is performing in her new Eras Tour! Unfortunately, tickets are selling out fast, so Bessie is thinking of flying to another city to attend the concert. The Eras tour is happening in () cities labeled , and for each pair of cities with there either exists a single direct flight from to or not.
A flight route from city to city () is a sequence of cities such that for each , there is a direct flight from city to city . For every pair of cities with , you are given the parity of the number of flight routes between them (0 for even, 1 for odd).
While planning her travel itinerary, Bessie got distracted and now wants to know how many pairs of cities have direct flights between them. It can be shown that the answer is uniquely determined.
입력
The first line contains .
Then follow lines. The th line contains integers. The th integer of the th line is equal to the parity of the number of flight routes from to .
출력
Output the number of pairs of cities with direct flights between them.