#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  while (cin >> N) {
    int Store[31][31], i, j, SumR, SumC, Count = 0;
    vector<int> Row, Col;
    memset(Store, false, sizeof(Store));
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++) cin >> Store[i][j];
    for (i = 0; i < N; i++) {
      SumR = 0;
      SumC = 0;
      for (j = 0; j < N; j++) {
        SumR += Store[i][j];
        SumC += Store[j][i];
      }
      Row.push_back(SumR);
      Col.push_back(SumC);
    }
    for (i = 0; i < N; i++) {
      for (j = 0; j < N; j++) {
        if (Row[i] < Col[j]) Count++;
      }
    }
    cout << Count << endl;
  }
}
