#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, a[30][30] = {0}, b[30] = {0}, x, c[30] = {0};
  int n, k = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    x = 0;
    for (j = 0; j < n; j++) {
      x = x + a[i][j];
    }
    b[i] = x;
  }
  for (j = 0; j < n; j++) {
    x = 0;
    for (i = 0; i < n; i++) {
      x = x + a[i][j];
    }
    c[j] = x;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (c[i] > b[j]) {
        k++;
      }
    }
  }
  cout << k;
  return 0;
}
