#include <bits/stdc++.h>
int main() {
  int n;
  int* sumV;
  int* sumH;
  int count = 0;
  int buf;
  scanf("%d", &n);
  sumV = new int[n];
  sumH = new int[n];
  for (int i = 0; i < n; i++) {
    sumV[i] = 0;
    sumH[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &buf);
      sumV[j] += buf;
      sumH[i] += buf;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (sumV[j] > sumH[i]) count++;
    }
  }
  printf("%d", count);
  delete sumV;
  delete sumH;
}
