#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int tamano;
  while (cin >> tamano) {
    int M[tamano][tamano];
    int Filas[tamano], Columnas[tamano];
    for (int i = 0; i < tamano; ++i) {
      int suma = 0;
      for (int j = 0; j < tamano; ++j) {
        cin >> M[i][j];
        suma += M[i][j];
      }
      Columnas[i] = suma;
    }
    for (int i = 0; i < tamano; ++i) {
      int suma = 0;
      for (int j = 0; j < tamano; ++j) {
        suma += M[j][i];
      }
      Filas[i] = suma;
    }
    int cont = 0;
    for (int i = 0; i < tamano; ++i) {
      for (int j = 0; j < tamano; ++j) {
        if (Columnas[i] < Filas[j]) cont++;
      }
    }
    cout << cont << endl;
  }
  return 0;
}
