#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const int maxn = 200005;
void task() {
  int n;
  cin >> n;
  vector<int> row(n, 0), coulmn(n, 0);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      int a;
      cin >> a;
      row[i] += a;
      coulmn[j] += a;
    }
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (coulmn[j] > row[i]) ans++;
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    task();
  }
  return 0;
}
