#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int MODULE = 1000000007;
struct Pos {
  int x, y;
};
double sqr(int a) { return a * a; }
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  vector<vector<long long int> > arr(n, vector<long long int>(n, 0));
  vector<long long int> q(n), w(n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> arr[i][j];
      q[i] += arr[i][j];
      w[j] += arr[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (q[i] < w[j]) {
        ++ans;
      }
    }
  }
  cout << ans;
  return 0;
}
