#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> rs, cs;
  for (int i = 0; i < n; i++) {
    rs.push_back(0);
    cs.push_back(0);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int k;
      cin >> k;
      rs[i] = rs[i] + k;
      cs[j] = cs[j] + k;
    }
  }
  int y = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (cs[i] > rs[j]) y++;
    }
  }
  cout << y << endl;
  return 0;
}
