#include <bits/stdc++.h>
using namespace std;
const int MAXN = 35;
int a[MAXN][MAXN];
int vert[MAXN], horz[MAXN];
int n;
inline int checkH(int h) {
  int sum = 0;
  for (int i = 0; i < n; i++) sum += a[h][i];
  return sum;
}
inline int checkV(int v) {
  int sum = 0;
  for (int i = 0; i < n; i++) sum += a[i][v];
  return sum;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    vert[i] = checkV(i);
    horz[i] = checkH(i);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (vert[j] > horz[i]) ans++;
  cout << ans;
  return 0;
}
