#include <bits/stdc++.h>
using namespace std;
int a[31][31];
int main() {
  int n;
  cin >> n;
  int *g = new int[n];
  int *v = new int[n];
  int x = 0, y = 0;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
      x += a[i][j];
    }
    g[i] = x;
    x = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      y += a[j][i];
    }
    v[i] = y;
    y = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (g[i] < v[j]) sum++;
    }
  }
  cout << sum;
}
