#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int row[40], col[40];
  memset(row, 0, sizeof(row));
  memset(col, 0, sizeof(col));
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (n); ++j) {
      int temp;
      scanf("%d", &temp);
      row[i] += temp;
      col[j] += temp;
    }
  }
  int ans = 0;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (n); ++j) {
      ans += col[j] > row[i];
    }
  }
  printf("%d\n", ans);
  return 0;
}
