#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<vector<int> > a(n);
  int i = 0;
  while (i < n) {
    int j = 0;
    while (j < n) {
      int s;
      scanf("%d", &s);
      a[i].push_back(s);
      j++;
    }
    i++;
  }
  vector<int> colsum;
  i = 0;
  while (i < n) {
    int j = 0;
    int temp = 0;
    while (j < n) {
      temp += a[j][i];
      j++;
    }
    colsum.push_back(temp);
    i++;
  }
  vector<int> rowsum;
  i = 0;
  while (i < n) {
    int j = 0;
    int temp = 0;
    while (j < n) {
      temp += a[i][j];
      j++;
    }
    rowsum.push_back(temp);
    i++;
  }
  int ans = 0;
  i = 0;
  while (i < n) {
    int j = 0;
    while (j < n) {
      if (colsum[i] > rowsum[j]) {
        ans += 1;
      }
      j++;
    }
    i++;
  }
  printf("%d", ans);
  return 0;
}
