#include <bits/stdc++.h>
using namespace std;
int s[35][35];
int sr[35];
int sc[35];
int main() {
  int n, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> s[i][j];
      sr[i] += s[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      sc[i] += s[j][i];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (sr[i] < sc[j]) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
