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