#include <bits/stdc++.h>
using namespace std;
int a[999][999], n, ans = 0, c = 0;
int v[999], h[999];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> a[i][j];
      ans += a[i][j];
    }
    h[i] = ans;
    ans = 0;
  }
  for (int j = 1; j <= n; ++j) {
    for (int i = 1; i <= n; ++i) {
      ans += a[i][j];
    }
    v[j] = ans;
    ans = 0;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (v[i] > h[j]) {
        c++;
      }
    }
  }
  cout << c;
}
