#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, numbers[30][30], sumrow[30] = {0}, sumcol[30] = {0}, win = 0;
  cin >> n;
  for (int row = 0; row < n; row++) {
    for (int col = 0; col < n; col++) {
      cin >> numbers[row][col];
      sumrow[row] += numbers[row][col];
    }
  }
  for (int col = 0; col < n; col++) {
    for (int row = 0; row < n; row++) sumcol[col] += numbers[row][col];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (sumrow[i] < sumcol[j]) win++;
    }
  }
  cout << win;
  return 0;
}
