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