#include <bits/stdc++.h>
using namespace std;
int n, a[50][50], ans, han[50], lie[50];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) han[i] += a[i][j];
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) lie[j] += a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (lie[i] > han[j]) ans++;
  printf("%d\n", ans);
  return 0;
}
