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