#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int board[31][31] = {0};
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> board[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) board[i][0] += board[i][j];
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) board[0][j] += board[i][j];
  int ans = 0;
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= n; i++) ans += (board[0][j] > board[i][0]);
  cout << ans << endl;
  return 0;
}
