#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1010;
const int V = 5010;
const int E = 4 * 1e6;
int main() {
  int n;
  cin >> n;
  int str[n + 1], stol[n + 1];
  fill(str, str + n + 1, 0);
  fill(stol, stol + n + 1, 0);
  int x;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> x;
      str[i] += x;
      stol[j] += x;
    }
  }
  int kol = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (str[i] < stol[j]) kol++;
    }
  }
  cout << kol << endl;
  return 0;
}
