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