#include <bits/stdc++.h>
using namespace std;
int N;
int f[35][35];
void solve() {
  int sum_r[35];
  int sum_c[35];
  for (int i = 0; i < N; i++) {
    sum_r[i] = 0;
    sum_c[i] = 0;
    for (int j = 0; j < N; j++) {
      sum_r[i] += f[i][j];
      sum_c[i] += f[j][i];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (sum_r[i] < sum_c[j]) ans++;
    }
  }
  cout << ans << endl;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      scanf("%d", &f[i][j]);
    }
  }
  solve();
}
