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