#include <bits/stdc++.h>
int main() {
  int n, i, j, sum, rsum, csum, nOfWinning = 0;
  scanf("%i", &n);
  int a[n][n];
  int r[n];
  int c[n];
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      scanf("%i", &a[i][j]);
    }
  }
  for (i = 0; i < n; i++) {
    rsum = 0;
    for (j = 0; j < n; j++) {
      rsum += a[i][j];
    }
    r[i] = rsum;
  }
  for (j = 0; j < n; j++) {
    csum = 0;
    for (i = 0; i < n; i++) {
      csum += a[i][j];
    }
    c[j] = csum;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (c[i] > r[j]) nOfWinning += 1;
    }
  }
  printf("%i", nOfWinning);
  return 0;
}
