#include <bits/stdc++.h>
using namespace std;
int a[50], b[50], c, n;
int main() {
  cin >> n;
  for (int i = 0, t; i < n; i++)
    for (int j = 0; j < n; j++) {
      cin >> t;
      a[i] += t;
      b[j] += t;
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) c += (a[i] < b[j]);
  }
  cout << c;
  return 0;
}
