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