#include <bits/stdc++.h>
using namespace std;
int M[30][30];
int col(int j, int N) {
  int sum = 0, i;
  for (i = 0; i < N; i++) {
    sum += M[i][j];
  }
  return sum;
}
int row(int i, int N) {
  int sum = 0, j;
  for (j = 0; j < N; j++) {
    sum += M[i][j];
  }
  return sum;
}
int main() {
  int N, i, j;
  cin >> N;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      cin >> M[i][j];
    }
  }
  int col2[30];
  int row2[30];
  for (i = 0; i < N; i++) col2[i] = col(i, N);
  for (i = 0; i < N; i++) row2[i] = row(i, N);
  int count = 0;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      if (col2[j] > row2[i]) count++;
    }
  }
  cout << count << endl;
  return 0;
}
