#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
int arr[35][35];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) scanf("%d", &arr[i][j]);
  }
  int rowsum[35], colsum[35];
  memset(rowsum, 0, sizeof(rowsum));
  memset(colsum, 0, sizeof(colsum));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      rowsum[i] += arr[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      colsum[i] += arr[j][i];
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (colsum[j] > rowsum[i]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
