#include <bits/stdc++.h>
using namespace std;
int N, a[33][33], winners;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> a[i][j];
      a[i][N] += a[i][j];
      a[N][j] += a[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++)
      if (a[N][j] > a[i][N]) winners++;
  }
  cout << winners;
  return 0;
}
