#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
const int MOD = 1e12 + 7;
const int MAX = 1e6 + 2;
const int INF = 0x3f3f3f3f;
using namespace std;
long long n;
long long a[1001][1001];
long long s1[1001], s2[1001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      s1[i] += a[i][j];
      s2[j] += a[i][j];
    }
  long long cnt = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (s2[j] > s1[i]) cnt++;
  cout << cnt << endl;
  return 0;
}
