Codeforces Round 110 (Div. 2)
A
Game Outcome
Codeforces
800
原题
←B →
翻译中…

Sherlock Holmes and Dr. Watson played some game on a checkered board $*n* × *n*$ in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to count the number of winning squares. To determine if the particular square is winning you should do the following. Calculate the sum of all numbers on the squares that share this column (including the given square) and separately calculate the sum of all numbers on the squares that share this row (including the given square). A square is considered winning if the sum of the column numbers is strictly greater than the sum of the row numbers.

翻译中…

image

翻译中…

For instance, lets game was ended like is shown in the picture. Then the purple cell is winning, because the sum of its column numbers equals $8 + 3 + 6 + 7 = 24$, sum of its row numbers equals $9 + 5 + 3 + 2 = 19$, and $24 > 19$.

翻译中…

Input

翻译中…

The first line contains an integer $*n*$ ($1 ≤ *n* ≤ 30$). Each of the following $*n*$ lines contain $*n*$ space-separated integers. The $*j*$-th number on the $*i*$-th line represents the number on the square that belongs to the $*j*$-th column and the $*i*$-th row on the board. All number on the board are integers from $1$ to $100$.

翻译中…

Output

翻译中…

Print the single number — the number of the winning squares.

翻译中…

Note

翻译中…

In the first example two upper squares are winning.

翻译中…

In the third example three left squares in the both middle rows are winning:

翻译中…

5 7 8 4
9 5 3 2
1 6 6 4
9 5 7 3

翻译中…

样例

Input #1
1
1
Output #1
0
InputCopy OutputCopy
Input #2
2
1 2
3 4
Output #2
2
InputCopy OutputCopy
Input #3
4
5 7 8 4
9 5 3 2
1 6 6 4
9 5 7 3
Output #3
6
InputCopy OutputCopy
题目信息
题号
157A
时间限制
2 s
内存限制
256 MB
标签
暴力

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。