#include <bits/stdc++.h>
using namespace std;
int a[31][31], sv[31], st[31], i, j, k, n;
int game(int a[][31], int n) {
  for (i = 1; i <= n; i++) {
    k = 0;
    for (j = 1; j <= n; j++) {
      k += a[i][j];
    }
    st[i] = k;
  }
  for (i = 1; i <= n; i++) {
    k = 0;
    for (j = 1; j <= n; j++) {
      k += a[j][i];
    }
    sv[i] = k;
  }
  k = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (sv[i] > st[j]) k++;
    }
  }
  return k;
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) cin >> a[i][j];
  }
  cout << game(a, n);
  return 0;
}
