#include <bits/stdc++.h>
int main() {
  int i, j;
  int n1;
  scanf("%d", &n1);
  int* l1 = (int*)malloc(4 * n1);
  int* l2 = (int*)malloc(4 * n1);
  for (i = 0; i < n1; i++) {
    l1[i] = 0;
    l2[i] = 0;
  }
  for (i = 0; i < n1; i++) {
    int a = 0;
    int b = 0;
    for (j = 0; j < n1; j++) {
      scanf("%d", &b);
      a += b;
      l2[j] += b;
    }
    l1[i] = a;
  }
  int fin = 0;
  for (i = 0; i < n1; i++) {
    for (j = 0; j < n1; j++) {
      if (l1[i] < l2[j]) fin++;
    }
  }
  printf("%d", fin);
  return 0;
}
