#include <bits/stdc++.h>
using namespace std;
int main() {
  int size;
  cin >> size;
  int arr[size][size];
  vector<int> y;
  vector<int> z;
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < size; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < size; i++) {
    int sum = 0;
    int sum2 = 0;
    for (int j = 0; j < size; j++) {
      sum += arr[i][j];
      sum2 += arr[j][i];
    }
    y.push_back(sum);
    z.push_back(sum2);
  }
  int countt = 0;
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < size; j++) {
      if (y[i] < z[j]) {
        countt++;
      }
    }
  }
  cout << countt;
  return 0;
}
