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