#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, table[60][60], i, j, colum[60] = {0}, row[60] = {0}, ans = 0;
  cin >> n;
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) {
      cin >> table[i][j];
      row[i] += table[i][j];
    }
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j) colum[i] += table[j][i];
  for (i = 0; i < n; ++i)
    for (j = 0; j < n; ++j)
      if (colum[i] > row[j]) ++ans;
  cout << ans;
  return 0;
}
