#include <bits/stdc++.h>
using namespace std;
const int INF = 1e8 + 10;
const int maxn = 30 + 5;
int a[maxn][maxn];
int row[maxn], col[maxn];
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
    }
    for (int i = 1; i <= n; i++) {
      row[i] = 0;
      for (int j = 1; j <= n; j++) row[i] += a[i][j];
    }
    for (int i = 1; i <= n; i++) {
      col[i] = 0;
      for (int j = 1; j <= n; j++) col[i] += a[j][i];
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (col[j] > row[i]) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
