n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
e = list(zip(*d))
c = 0
for i in range(n):
for j in range(n):
if sum(d[i]) < sum(e[j]):
c += 1
print(c)
#include <bits/stdc++.h>
using namespace std;
#define beshoo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
long long sum1,sum2,c,mx,mn,t;
bool z=0;
set<long long>se;
vector<long long>v;
map<pair<long long,long long>,long long>mp;
set<long long>::iterator its=se.begin();
map<pair<long long,long long>,long long>::iterator itm=mp.begin();
int main()
{
beshoo
int n;cin>>n;int arr1[n]={},arr2[n]={};
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int x;cin>>x;
arr1[i]+=x;
arr2[j]+=x;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(arr2[j]>arr1[i])c++;
}
}
cout<<c;
return 0;
}
// Our functions
long long factorial(long long x)
{
long long fact=1;for(long long i=1;i<=x;i++){fact*=i;}
return fact;
}
long long permutations(long long x,long long y)
{
long long fact1=1;for(long long i=1;i<=max(x,y);i++){fact1*=i;}
long long fact2=1;for(long long i=1;i<=abs(x-y);i++){fact2*=i;}
return fact1/fact2;
}
long double combinations(long double x,long double y)
{
long double ans =1;
for(long double i=0,w=min(y,abs(x-y));i<w;i++){ans =(ans*(x-i))/(i+1);}
return ans;
}
bool isprime(long long n)
{
if(n<2||n%2==0)return false;
if(n==2)return true;
for(long long i=3;i<=sqrt(n);i+=2){if(n%i==0)return false;}
return true;
}
//Done bro
14B - Young Photographer | 143A - Help Vasilisa the Wise 2 |
320A - Magic Numbers | 1658A - Marin and Photoshoot |
514A - Chewbaсca and Number | 382A - Ksenia and Pan Scales |
734B - Anton and Digits | 1080A - Petya and Origami |
1642D - Repetitions Decoding | 1440A - Buy the String |
1658F - Juju and Binary String | 478A - Initial Bet |
981A - Antipalindrome | 365A - Good Number |
1204B - Mislove Has Lost an Array | 1409D - Decrease the Sum of Digits |
1476E - Pattern Matching | 1107A - Digits Sequence Dividing |
1348A - Phoenix and Balance | 1343B - Balanced Array |
1186A - Vus the Cossack and a Contest | 1494A - ABC String |
1606A - AB Balance | 1658C - Shinju and the Lost Permutation |
1547C - Pair Programming | 550A - Two Substrings |
797B - Odd sum | 1093A - Dice Rolling |
1360B - Honest Coach | 1399C - Boats Competition |