Sherlock Holmes and Dr. Watson played some game on a checkered board n × n in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to count the number of winning squares. To determine if the particular square is winning you should do the following. Calculate the sum of all numbers on the squares that share this column (including the given square) and separately calculate the sum of all numbers on the squares that share this row (including the given square). A square is considered winning if the sum of the column numbers is strictly greater than the sum of the row numbers.

<image>

For instance, lets game was ended like is shown in the picture. Then the purple cell is winning, because the sum of its column numbers equals 8 + 3 + 6 + 7 = 24, sum of its row numbers equals 9 + 5 + 3 + 2 = 19, and 24 > 19.

Input

The first line contains an integer n (1 ≤ n ≤ 30). Each of the following n lines contain n space-separated integers. The j-th number on the i-th line represents the number on the square that belongs to the j-th column and the i-th row on the board. All number on the board are integers from 1 to 100.

Output

Print the single number — the number of the winning squares.

Examples

Input

1
1


Output

0


Input

2
1 2
3 4


Output

2


Input

4
5 7 8 4
9 5 3 2
1 6 6 4
9 5 7 3


Output

6

Note

In the first example two upper squares are winning.

In the third example three left squares in the both middle rows are winning:
    
    
    5 7 8 4  
    9 5 3 2  
    1 6 6 4  
    9 5 7 3

Source: codeforces | Difficulty: EASY
Tags: Complete search


Solutions:
n = int(input())
r = lambda : list(map(int, input().split()))
arr = []
for i in range(n):
	a = r()
	arr.append(a)
row = [sum(i) for i in arr]
col = []
for i in range(n):
	c = 0
	for j in range(n):
		c += arr[j][i]
	col.append(c)
ans = 0
for i in range(n):
	for j in range(n):
		if row[i] < col[j]:
			ans += 1
print(ans)


n = int(input())
total = 0
board = []
for i in range(n):
	row = list(map(int, input().split()))
	board.append(row)
for i in range(n):
	for j in range(n):
		(row_s, column) = (0, 0)
		for k in range(n):
			row_s += board[i][k]
		for l in range(n):
			column += board[l][j]
		if column > row_s:
			total += 1
print(total)


class CodeforcesTask157ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.board = []

	def read_input(self):
		self.n = int(input())
		for x in range(self.n):
			self.board.append([int(y) for y in input().split(' ')])

	def process_task(self):
		hor_sums = [sum(x) for x in self.board]
		vert_sums = []
		for x in range(self.n):
			ss = 0
			for y in range(self.n):
				ss += self.board[y][x]
			vert_sums.append(ss)
		winning = 0
		for hor in hor_sums:
			for ver in vert_sums:
				if ver > hor:
					winning += 1
		self.result = str(winning)

	def get_result(self):
		return self.result
Solution = CodeforcesTask157ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = [LI() for _ in range(n)]
	ans = 0
	for i in range(n):
		for j in range(n):
			yoko = sum(l[i])
			tate = 0
			for k in range(n):
				tate += l[k][j]
			if yoko < tate:
				ans += 1
	return ans
print(main())


n = int(input())
matrix = []
row_sums = []
for r in range(n):
	row = list(map(int, input().split()))
	matrix.append(row)
	row_sums.append(sum(row))
result = 0
for c in range(n):
	col_sum = 0
	for r in range(n):
		col_sum += matrix[r][c]
	for row_sum in row_sums:
		if col_sum > row_sum:
			result += 1
print(result)


def judge(i, j, matrix: list):
	(col, row) = (0, 0)
	row = sum(matrix[i])
	for k in range(len(matrix)):
		col += matrix[k][j]
	if col > row:
		return True
	else:
		return False

def counter(matrix: list):
	lenth = len(matrix)
	count = 0
	for i in range(lenth):
		for j in range(lenth):
			if judge(i, j, matrix):
				count += 1
	return count
lenth = int(input())
matrix = [list(map(int, input().split(' '))) for i in range(lenth)]
print(counter(matrix))


n = int(input())
a = []
for i in range(n):
	b = list(map(int, input().split()))
	a.append(b)
zip_a = list(zip(*a))
rows = []
columns = []
for row in a:
	rows.append(sum(row))
for column in zip_a:
	columns.append(sum(column))
count = 0
for i in range(n):
	for j in range(n):
		if columns[j] > rows[i]:
			count += 1
print(count)


matrix = []
for _ in range(int(input())):
	matrix.append(list(map(int, input().split())))
num_wining = 0
for row in matrix:
	row_sum = sum(row)
	for (i, x) in zip(row, range(len(row))):
		colum_sum = sum([row[x] for row in matrix])
		if colum_sum > row_sum:
			num_wining += 1
print(num_wining)


n = int(input())
k = []
for i in range(n):
	k.append(tuple(map(int, input().split())))
k1 = list(zip(*k))
ans = 0
for i in range(n):
	for j in range(n):
		if sum(k1[j]) > sum(k[i]):
			ans += 1
print(ans)


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
if n == 1:
	print(0)
	exit()
k = 0
for i in range(n):
	for j in range(n):
		s = 0
		for i1 in range(n):
			s += l[i][i1]
			s -= l[i1][j]
		if s < 0:
			k += 1
print(k)


n = int(input())
arr = list()
for _ in range(n):
	arr.append(list(map(int, input().split())))
cnt = 0
for i in range(n):
	for j in range(n):
		cols = 0
		for k in range(n):
			cols += arr[k][j]
		if sum(arr[i]) < cols:
			cnt += 1
print(cnt)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
m = 0
x = []
z = []
for i in range(n):
	x.append(sum(a[i]))
	y = []
	for j in range(n):
		y.append(a[j][i])
	z.append(sum(y))
for i in range(n):
	for j in range(n):
		if x[i] < z[j]:
			m += 1
print(m)


n = int(input())
m = [[int(j) for j in input().split()] for i in range(n)]
rowsum = [sum(i) for i in m]
colsum = [sum([row[i] for row in m]) for i in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if rowsum[i] < colsum[j]:
			ans += 1
print(ans)


a = int(input())
l = []
for i in range(a):
	s = input().split()
	l.append(s)

def rowsum(l):
	p = 0
	for i in range(len(l)):
		p = p + int(l[i])
	return p

def colsum(l, j):
	p = 0
	for i in range(len(l)):
		p = p + int(l[i][j])
	return p
c = len(l)
t = 0
for i in range(c):
	for j in range(c):
		p = int(l[i][j])
		m = rowsum(l[i])
		n = colsum(l, j)
		if n > m:
			t = t + 1
print(t)


def question1():
	matrix_size = int(input())
	matrix = []
	for i in range(matrix_size):
		row = list(map(int, input().split()))
		matrix.append(row)
	sum_rows = [0 for i in range(matrix_size)]
	sum_cols = [0 for i in range(matrix_size)]
	for row in range(matrix_size):
		for col in range(matrix_size):
			sum_rows[row] += matrix[row][col]
			sum_cols[col] += matrix[row][col]
	count_winning_squares = 0
	for row in range(matrix_size):
		for col in range(matrix_size):
			if sum_cols[col] > sum_rows[row]:
				count_winning_squares += 1
	return count_winning_squares
remained_test_cases = 1
while remained_test_cases > 0:
	print(question1())
	remained_test_cases -= 1


n = int(input())
l = []
sr = []
sc = [0] * n
num = 0
for i in range(n):
	li = list(map(int, input().split()))
	l.append(li)
	s = sum(li)
	sr.append(s)
for i in range(n):
	for j in range(n):
		sc[j] += l[i][j]
for i in range(n):
	sr1 = sr + [sc[i]]
	sr1.sort()
	num += sr1.index(sc[i])
print(num)


import sys
import math
n = int(sys.stdin.readline())
v = [0] * n
h = [0] * n
for i in range(n):
	st = sys.stdin.readline().split()
	for j in range(n):
		v[j] += int(st[j])
		h[i] += int(st[j])
res = 0
for i in range(n):
	for j in range(n):
		if v[i] > h[j]:
			res += 1
print(res)


number_of_testcases = 1
for _ in range(number_of_testcases):
	size_of_matrix = int(input())
	given_matrix = []
	for i in range(size_of_matrix):
		row = list(map(int, input().split()))
		given_matrix.append(row)
	sum_of_rows = [0 for i in range(size_of_matrix)]
	sum_of_cols = [0 for i in range(size_of_matrix)]
	for row in range(size_of_matrix):
		for col in range(size_of_matrix):
			sum_of_rows[row] += given_matrix[row][col]
			sum_of_cols[col] += given_matrix[row][col]
	num_winning_squares = 0
	for row in range(size_of_matrix):
		for col in range(size_of_matrix):
			if sum_of_rows[row] < sum_of_cols[col]:
				num_winning_squares += 1
	print(num_winning_squares)


n = int(input())
lst = []
count = 0
for i in range(n):
	lst.append(list(map(int, input().split())))
for i in range(n):
	for j in range(n):
		if sum((lst[i][j] for i in range(n))) > sum(lst[i]):
			count += 1
print(count)


def solve():
	n = int(input())
	(l, r, c, ct) = ([], [-1 for i in range(0, n)], [0 for i in range(0, n)], 0)
	for i in range(0, n):
		x = list(map(int, input().split()))
		for j in range(0, n):
			c[j] += x[j]
		l.append(x)
	for i in range(0, n):
		for j in range(0, n):
			if r[i] == -1:
				r[i] = sum(l[i])
			if r[i] < c[j]:
				ct += 1
	print(ct)
solve()


import bisect as bs
a = [list(map(int, input().split())) for _ in range(int(input()))]
rows = list(sorted([sum(r) for r in a]))
cols = [sum(b) for b in zip(*a)]
print(sum([bs.bisect_left(rows, c) for c in cols]))


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(m)
rows = []
columns = []
for i in range(n):
	s = 0
	s1 = 0
	for j in range(n):
		s += l[i][j]
		s1 += l[j][i]
	rows.append(s)
	columns.append(s1)
c = 0
for i in range(n):
	for j in range(n):
		if rows[i] < columns[j]:
			c += 1
print(c)


import sys
import math
import bisect

def solve(A):
	n = len(A)
	row = [0] * n
	col = [0] * n
	for i in range(n):
		for j in range(n):
			row[i] += A[i][j]
			col[j] += A[i][j]
	ans = 0
	for i in range(n):
		for j in range(n):
			if col[j] > row[i]:
				ans += 1
	return ans

def main():
	n = int(input())
	A = []
	for i in range(n):
		A.append(list(map(int, input().split())))
	print(solve(A))
main()


import sys
f = sys.stdin
n = int(f.readline().strip())
a = [list(map(int, i.split())) for i in f.read().strip().split('\n')]
hs = []
for i in a:
	hs.append(sum(i))
vs = []
for i in range(n):
	s = 0
	for j in range(n):
		s += a[j][i]
	vs.append(s)
cnt = 0
for i in hs:
	for j in vs:
		if j > i:
			cnt += 1
print(cnt)


n = int(input())
a = []
k = 0
for _ in range(n):
	a += [list(map(int, input().split() + ['0']))]
a += [[0]]
for i in range(n):
	for j in range(n):
		k += sum(a[i]) < sum([a[i][j] for i in range(n)])
print(k)


n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
sums = [sum(arr[i]) for i in range(n)]
res = 0
for i in range(n):
	col_sum = sum((arr[j][i] for j in range(n)))
	res += sum((1 for i in range(n) if col_sum > sums[i]))
print(res)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
ABCD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
months = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}
MOD = 1000000007
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
r = [[0] * n for i in range(n)]
c = [[0] * n for i in range(n)]
l = []
for i in range(n):
	ll = list(map(int, input().split(' ')))
	l.append(ll)
	s = sum(ll)
	for j in range(n):
		r[i][j] = s
for i in range(n):
	s = 0
	for j in range(n):
		s += l[j][i]
	for j in range(n):
		c[j][i] = s
ans = 0
for i in range(n):
	for j in range(n):
		if r[i][j] < c[i][j]:
			ans += 1
print(ans)


n = int(input())
r = []
for i in range(n):
	r.append(list(map(int, input().split(' '))))
Rows = list(map(sum, r))
Columns = list(map(sum, zip(*r)))
ans = 0
for i in Columns:
	for a in Rows:
		if i > a:
			ans += 1
print(ans)


n = int(input())
x = []
for i in range(n):
	x += [list(map(int, input().split()))]
h = [-1] * n
v = [-1] * n
for i in range(n):
	h[i] = sum(x[i])
	v[i] = sum([x[j][i] for j in range(n)])
r = 0
for i in range(n):
	for j in range(n):
		r += int(v[i] > h[j])
print(r)


def solution(a):
	row = []
	col = []
	c = sum_row = sum_col = 0
	for i in range(len(a)):
		sum_row = 0
		sum_col = 0
		for j in range(len(a)):
			sum_row += a[i][j]
			sum_col += a[j][i]
		col.append(sum_col)
		row.append(sum_row)
	for i in range(len(a)):
		for j in range(len(a)):
			if col[j] > row[i]:
				c += 1
	print(c)
n = int(input(''))
a = []
for i in range(n):
	r = list(map(int, input('').split()))
	a.append(r)
solution(a)


n = int(input())
L = []
for i in range(n):
	L.append(list(map(int, input().split())))
R = []
for i in range(n):
	R.append(sum(L[i]))
C = []
for i in range(n):
	s = 0
	for j in range(n):
		s += L[j][i]
	C.append(s)
ans = 0
for i in range(n):
	for j in range(n):
		if C[j] > R[i]:
			ans += 1
print(ans)


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
k = 0
for i in range(n):
	s2 = sum(a[i])
	for j in range(n):
		s1 = sum((a[ii][j] for ii in range(n)))
		if s1 > s2:
			k += 1
print(k)


def main():
	n = int(input())
	l = [tuple(map(int, input().split())) for _ in range(n)]
	(h, v) = (tuple(map(sum, l)), tuple(map(sum, zip(*l))))
	print(sum((x > y for x in v for y in h)))
main()


n = int(input())
row = [0] * n
col = [0] * n
count = 0
for i in range(n):
	l = list(map(int, input().split()))
	row[i] += sum(l)
	for j in range(n):
		col[j] += l[j]
for i in range(n):
	for j in range(n):
		if row[i] < col[j]:
			count += 1
print(count)


l = []
q = int(input())
for _ in range(q):
	l.append(list(map(int, input().split())))
row = []
for i in l:
	row.append(sum(i))
col = []
r = [[] for _ in range(q)]
for i in range(q):
	for j in range(q):
		r[j].append(l[i][j])
for i in r:
	col.append(sum(i))
coun = 0
for i in row:
	for j in col:
		if j > i:
			coun += 1
print(coun)


n = int(input())
arr = []
for i in range(n):
	arr.append([])
	arr[i] = [int(z) for z in input().split()]
c = 0
for i in range(n):
	for j in range(n):
		(row, col) = (0, 0)
		row = sum(arr[i])
		for k in range(n):
			col = col + arr[k][j]
		if col > row:
			c = c + 1
print(c)


n = int(input())
rows = [[int(x) for x in input().split(' ')] for i in range(n)]
cols = [[row[i] for row in rows] for i in range(n)]
winners = 0
for row in rows:
	for col in cols:
		winners += int(sum(col) > sum(row))
print(winners)


a = int(input())
b = list()
for i in range(a):
	b.append(list(map(int, input().split())))
h = 0
for i in range(a):
	for j in range(a):
		if sum((b[i][j] for i in range(a))) > sum(b[i]):
			h += 1
print(h)


a = int(input())
if a == 1:
	print(0)
else:
	t = []
	for x in range(a):
		t.append(list(map(int, input().split())))
	s = []
	for k in range(a):
		u = []
		for j in range(a):
			u.append(t[j][k])
		s.append(sum(u))
	l = 0
	for jd in range(a):
		for h in range(a):
			if sum(t[jd]) < s[h]:
				l += 1
	print(l)


n = int(input())
l = []
for _ in range(n):
	l.append(list(map(int, input().split())))
rows = []
for i in l:
	rows.append(sum(i))
columns = []
for i in range(n):
	su = 0
	for j in range(n):
		su += l[j][i]
	columns.append(su)
co = 0
for i in columns:
	for j in rows:
		if i > j:
			co += 1
print(co)


n = int(input())
matrix = []
rowsum = 0
colsum = 0
k = 0
r = []
c = []
for i in range(n):
	matrix.append(list(map(int, input().split())))
for i in range(n):
	rowsum = 0
	colsum = 0
	for j in range(n):
		rowsum += matrix[i][j]
		colsum += matrix[j][i]
	r.append(rowsum)
	c.append(colsum)
for i in range(n):
	for j in range(n):
		if c[i] > r[j]:
			k += 1
print(k)


n = int(input())
a = [list(map(int, input().split())) for x in range(n)]
c = list(zip(*a))
k = 0
a_sum = [sum(x) for x in a]
c_sum = [sum(x) for x in c]
for x in a_sum:
	for y in c_sum:
		if x < y:
			k += 1
print(k)


n = int(input())
res = 0
li = []
for _ in range(n):
	li.append(list(map(int, input().split())))
rr = []
cc = []
for i in li:
	rr.append(sum(i))
c = 0
while c < n:
	su = 0
	for i in li:
		su += i[c]
	cc.append(su)
	c += 1
for i in range(n):
	for j in range(n):
		if cc[j] > rr[i]:
			res += 1
print(res)


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))

def rowSum(i, j, arr):
	return sum(arr[i])

def colSum(i, j, arr):
	sum = 0
	for i in range(n):
		sum += arr[i][j]
	return sum

def func(n, arr):
	count = 0
	for i in range(n):
		for j in range(n):
			if colSum(i, j, arr) > rowSum(i, j, arr):
				count += 1
	return count
print(func(n, arr))


n = int(input())
l = []
for i in range(n):
	sss = list(map(int, input().split()))
	l.append(sss)
(x, y) = ([], [])
for i in range(n):
	s = sum(l[i])
	x.append(s)
s = 0
for i in range(n):
	s = 0
	for j in range(n):
		s = s + l[j][i]
	y.append(s)
c = 0
for i in range(n):
	for j in range(n):
		if y[j] > x[i]:
			c = c + 1
print(c)


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	M = []
	for r in range(n):
		M.append(read_ints())
	SR = [sum(row) for row in M]
	SC = []
	for c in range(n):
		sm = 0
		for r in range(n):
			sm += M[r][c]
		SC.append(sm)
	count = 0
	for r in range(n):
		for c in range(n):
			if SC[c] > SR[r]:
				count += 1
	print(count)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
(h, v) = ([0] * n, [0] * n)
for i in range(n):
	t = list(map(int, input().split()))
	h[i] = sum(t)
	for j in range(n):
		v[j] += t[j]
print(sum((v[j] > h[i] for i in range(n) for j in range(n))))


n = int(input())
m = []
for _ in range(n):
	m.append(list(map(int, input().split())))
ans = 0
for i in range(n):
	row_sum = sum(m[i])
	for j in range(n):
		col_sum = 0
		for k in range(n):
			col_sum += m[k][j]
		if col_sum > row_sum:
			ans += 1
print(ans)


a = []
for i in range(int(input())):
	a.append(list(map(int, input().split())))
l = 0
for i in range(len(a)):
	s = a[i]
	d = []
	for j in range(len(a)):
		for k in range(len(a)):
			d.append(a[k][j])
		if sum(s) < sum(d):
			l += 1
		d = []
print(l)


n = int(input())
b = []
rs = []
for r in range(n):
	b.append([int(x) for x in input().split()])
	rs.append(sum(b[-1]))
val = 0
for c in range(n):
	cs = sum((b[r][c] for r in range(n)))
	val += sum((1 for r in range(n) if cs > rs[r]))
print(val)


n = int(input())
board = []
for i in range(n):
	board.append(list(map(int, input().split())))
win = 0
row_len = len(board[0])
l_b = len(board)
for i in range(l_b):
	for j in range(row_len):
		element = board[i][j]
		row_sum = 0
		col_sum = 0
		for x in range(row_len):
			row_sum += board[i][x]
			col_sum += board[x][j]
		if col_sum > row_sum:
			win += 1
print(win)


n = int(input())
a = []
ans = 0
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	for j in range(n):
		(s1, s2) = (0, 0)
		for k in range(n):
			s1 += a[i][k]
		for k in range(n):
			s2 += a[k][j]
		if s2 > s1:
			ans += 1
print(ans)


num = int(input())
p = []
q = []
for i in range(num):
	p.append(input().split())
for i in range(num):
	c = []
	for j in range(num):
		c.append(p[j][i])
	q.append(c)
for i in range(num):
	c = 0
	for j in p[i]:
		c += int(j)
	p[i] = c
for i in range(num):
	c = 0
	for j in q[i]:
		c += int(j)
	q[i] = c
count = 0
for i in q:
	for j in p:
		if i > j:
			count += 1
print(count)


import math

def solve():
	n = int(input())
	res = []
	for i in range(n):
		l = list(map(int, input().split()))
		res.append(l)
	r = [0] * n
	for i in range(n):
		summ = 0
		for j in range(n):
			summ += res[i][j]
		r[i] = summ
	c = [0] * n
	for i in range(n):
		summ = 0
		for j in range(n):
			summ += res[j][i]
		c[i] = summ
	ans = 0
	for i in range(n):
		for j in range(n):
			if c[i] > r[j]:
				ans += 1
	print(ans)
t = 1
for i in range(t):
	solve()


n = int(input())
v = []
for _ in range(n):
	a = list(map(int, input().split()))
	v.append(a)
k = [[v[j][i] for j in range(n)] for i in range(n)]
c = 0
for i in k:
	for j in v:
		if sum(i) > sum(j):
			c += 1
print(c)


n = int(input())
l = []
(r, c) = ([], [0] * n)
a = 0
for i in range(n):
	t = list(map(int, input().split()))
	l.append(t)
	r.append(sum(t))
	for j in range(n):
		c[j] += t[j]
for i in range(n):
	for j in range(n):
		if r[i] < c[j]:
			a += 1
print(a)


n = int(input())
board = []
for line in range(n):
	board.append([int(x) for x in input().split()])
wins = 0
for row in range(n):
	for column in range(n):
		rowSum = columnSum = 0
		for i in range(n):
			rowSum += board[row][i]
		for i in range(n):
			columnSum += board[i][column]
		if columnSum > rowSum:
			wins += 1
print(wins)


X = list(map(int, input().split()))
Board = []
for i in range(X[0]):
	Board.append(list(map(int, input().split())))
Answer = 0
for i in range(X[0]):
	RowSum = sum(Board[i])
	for j in range(X[0]):
		ColumnSum = 0
		for k in range(X[0]):
			ColumnSum += Board[k][j]
		Answer += 1 if ColumnSum > RowSum else 0
print(Answer)


n = int(input())
a = []
b = []
for i in range(n):
	k = list(map(int, input().split()))
	a.append(k)
	if i == 0:
		b = k.copy()
	else:
		j = 0
		for ii in k:
			b[j] += ii
			j += 1
if n == 1:
	print(0)
else:
	c = 0
	for i in a:
		u = sum(i)
		for j in range(n):
			if b[j] > u:
				c = c + 1
	print(c)


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(m)
row = []
for i in range(n):
	row.append(sum(l[i]))
col = []
for i in range(n):
	a = 0
	for j in range(n):
		a += l[j][i]
	col.append(a)
(i, j) = (0, 0)
ans = 0
while i < n:
	if j != n and row[i] < col[j]:
		ans += 1
	if j == n:
		j = 0
		i += 1
	else:
		j += 1
print(ans)


n = int(input())
(sc, sr) = ([0] * n, [0] * n)
for i in range(n):
	a = list(map(int, input().split()))
	for j in range(n):
		sr[i] += a[j]
		sc[j] += a[j]
ans = 0
for i in range(n):
	for j in range(n):
		if sc[i] > sr[j]:
			ans += 1
print(ans)


dl = []
n = int(input())
sum_r = []
sum_c = []
l = []
count = 0
for k in range(n):
	l = list(map(int, input().split()))
	dl.append(l)
if n == 1:
	print(0)
else:
	for i in range(n):
		sum_r.append(sum(dl[i]))
	for i in range(n):
		s = 0
		for j in range(n):
			s = s + dl[j][i]
		sum_c.append(s)
	maxx = max(sum_c)
	mini = min(sum_r)
	e = sum_c.index(maxx)
	r = sum_r.index(mini)
	for i in range(n):
		for j in range(n):
			if sum_r[i] < sum_c[j]:
				count = count + 1
	print(count)


n = int(input())
l = []
for i in range(n):
	xr = input().split()
	x = []
	for p in xr:
		x.append(p)
	c = []
	for j in range(n):
		c.append(x[j])
	l.append(c)

def game():
	p = 0
	am = []
	bm = []
	for i2 in range(n):
		a = 0
		j2 = 0
		while j2 < n:
			a = a + int(l[i2][j2])
			j2 = j2 + 1
		am.append(a)
	for j1 in range(n):
		b = 0
		i1 = 0
		while i1 < n:
			b = b + int(l[i1][j1])
			i1 = i1 + 1
		bm.append(b)
	for i1 in range(n):
		for j1 in range(n):
			if am[i1] < bm[j1]:
				p = p + 1
	return p
print(game())


n = int(input())
a = list()
s1 = list()
s2 = [0 for i in range(n)]
for i in range(n):
	a.append([int(k) for k in input().split()])
	s1.append(sum(a[i]))
	for m in range(n):
		s2[m] += a[i][m]
x = 0
for r in s2:
	for k in s1:
		x += 1 * (r > k)
print(x)


def main_function():
	input_list = [[int(i) for i in input().split(' ')] for i in range(int(input()))]
	counter = 0
	for i in range(len(input_list)):
		for j in range(len(input_list[i])):
			column = 0
			row = 0
			for l in range(len(input_list[i])):
				row += input_list[i][l]
			for g in range(len(input_list)):
				column += input_list[g][j]
			if column > row:
				counter += 1
	return str(counter)
print(main_function())


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
s = []
for i in range(n):
	s.append(list(map(int, input().split())))
coloumn = []
row = []
for i in range(n):
	count = 0
	for j in range(n):
		count += s[j][i]
	coloumn.append(count)
for i in range(n):
	row.append(sum(s[i]))
win = 0
for i in range(len(coloumn)):
	for j in range(len(row)):
		if coloumn[i] > row[j]:
			win += 1
print(win)


n = int(input())
l = []
ans = 0
for _ in range(n):
	a = [int(y) for y in input().split()]
	l.append(a)

def col(w):
	h = 0
	for u in range(n):
		h += l[u][w]
	return h

def row(p, q):
	g = sum(l[p])
	if col(q) > g:
		return True
	else:
		return False
for i in range(n):
	for j in range(n):
		if row(i, j):
			ans += 1
print(ans)


def main():
	l = [list(map(int, input().split())) for _ in range(int(input()))]
	h = list(map(sum, l))
	print(sum((x > y for x in map(sum, zip(*l)) for y in h)))
main()


n = int(input())
a = []
h = []
v = []
for i in range(n):
	a.append([int(x) for x in input().split()])
for l in a:
	h.append(sum(l))
for l in zip(*a):
	v.append(sum(l))
ans = 0
for x in h:
	for y in v:
		if y > x:
			ans += 1
print(ans)


n = int(input())
L = []
for i in range(n):
	L.append(input().split())
for i in range(n):
	for j in range(n):
		L[i][j] = int(L[i][j])
ans = 0
for i in range(n):
	sum_row = sum(L[i])
	for j in range(n):
		sum_col = 0
		for k in range(n):
			sum_col += L[k][j]
		if sum_col > sum_row:
			ans += 1
print(ans)


n = int(input())
a = []
b = []
ans = 0
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	for j in range(n):
		for k in range(n):
			b.append(a[k][j])
		if sum(b) > sum(a[i]):
			ans += 1
		b = []
print(ans)


l = []
n = int(input())
for i in range(n):
	l.append(list(map(int, input().split())))
l2 = [x[:] for x in l]
for i in range(n):
	for j in range(n):
		l[i][j] = int(l2[j][i])
c = 0
for i in l2:
	for j in l:
		if sum(i) < sum(j):
			c += 1
print(c)


from sys import stdin, stdout
n = int(stdin.readline())
maps = []
ans = 0
for i in range(n):
	maps.append(list(map(int, stdin.readline().split())))
for i in range(n):
	for j in range(n):
		(string, column) = (0, 0)
		for z in range(n):
			string += maps[z][j]
			column += maps[i][z]
		if string > column:
			ans += 1
stdout.write(str(ans))


n = int(input())
data = []
data_t = [[] for _ in range(n)]
for _ in range(n):
	data.append(list(map(int, input().split())))
	for (j, v) in enumerate(data[-1]):
		data_t[j].append(v)
row_sums = [sum(row) for row in data]
col_sums = [sum(col) for col in data_t]
result = 0
for i in range(n):
	for j in range(n):
		result += col_sums[j] > row_sums[i]
print(result)


def sum(a):
	s = 0
	for i in a:
		s = s + i
	return s
a = []
n = int(input())
for i in range(n):
	a.append(list(map(int, input().split())))
b = []
c = []
for i in range(n):
	b.append(sum(a[i]))
for i in range(n):
	for j in range(i):
		x = a[i][j]
		a[i][j] = a[j][i]
		a[j][i] = x
for i in range(n):
	c.append(sum(a[i]))
k = 0
for i in range(n):
	for j in range(n):
		if b[i] < c[j]:
			k += 1
print(k)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
n = int(input())
ans = 0
a = []
for y in range(n):
	a.append([int(x) for x in input().split()])
for x in range(n):
	for y in range(n):
		s = 0
		for z in range(n):
			s += a[z][y]
		if s > sum(a[x]):
			ans += 1
print(ans)


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
row_sum = []
col_sum = []
for i in range(n):
	row_sum.append(sum(arr[i]))
for i in range(n):
	temp = 0
	for j in range(n):
		temp += arr[j][i]
	col_sum.append(temp)
ans = 0
for i in range(n):
	for j in range(n):
		if col_sum[i] > row_sum[j]:
			ans += 1
print(ans)


import os, sys
from io import BytesIO, IOBase
from collections import deque, Counter, defaultdict as dft
from heapq import heappop, heappush
from math import log, sqrt, factorial, cos, tan, sin, radians, log2, ceil, floor
from bisect import bisect, bisect_left, bisect_right
from decimal import *
import sys, threading
from itertools import permutations, combinations
from copy import deepcopy
input = sys.stdin.readline
ii = lambda : int(input())
si = lambda : input().rstrip()
mp = lambda : map(int, input().split())
ms = lambda : map(str, input().strip().split(' '))
ml = lambda : list(mp())
mf = lambda : map(float, input().split())
alphs = 'abcdefghijklmnopqrstuvwxyz'

def solve():
	n = ii()
	grid = []
	r = [0] * n
	c = [0] * n
	for i in range(n):
		ls = ml()
		r[i] += sum(ls)
		for j in range(n):
			c[j] += ls[j]
	count = 0
	for i in range(n):
		for j in range(n):
			count += int(c[j] > r[i])
	print(count)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
tc = 1
for i in range(tc):
	solve()


n = int(input())
rows = list()
for i in range(n):
	rows.append(tuple(map(int, input().split())))
ans = 0
for i in range(n):
	rows_total = sum(rows[i])
	for k in range(n):
		columns_total = 0
		for j in rows:
			columns_total += j[k]
		if rows_total < columns_total:
			ans += 1
print(ans)


n = int(input())
(row_sum, col_sum) = ([0] * n, [0] * n)
for i in range(n):
	a = list(map(int, input().split()))
	row_sum[i] = sum(a)
	for j in range(n):
		col_sum[j] += a[j]
ans = 0
for i in range(n):
	for j in range(n):
		if col_sum[j] > row_sum[i]:
			ans += 1
print(ans)


def main():
	n = int(input())
	L = []
	ans = 0
	for _ in range(n):
		L.append(list(map(int, input().split())))
	for i in range(n):
		for j in range(n):
			si = 0
			sj = 0
			for k in range(n):
				si += L[i][k]
			for k in range(n):
				sj += L[k][j]
			if sj > si:
				ans += 1
	print(ans)
main()


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
result = 0
b = [sum(x) for x in zip(*a)]
c = list()
for i in range(n):
	c.append(sum(a[i]))
for i in range(n):
	for j in range(n):
		if b[i] > c[j]:
			result += 1
print(result)


n = int(input())
table = [list(map(int, input().split())) for i in range(n)]
hor = [0] * n
ver = [0] * n
for i in range(n):
	hor[i] = sum(table[i])
	for j in range(n):
		ver[i] += table[j][i]
ans = 0
for i in range(n):
	for j in range(n):
		ans += hor[i] < ver[j]
print(ans)


def input_matrix(n):
	matrix = []
	for i in range(n):
		matrix.append(list(map(int, input().split())))
	return matrix

def get_sum_in_row(a, i):
	return sum(a[i])

def get_sum_in_col(a, j):
	return sum((a[i][j] for i in range(len(a))))
n = int(input())
a = input_matrix(n)
row_sums = [get_sum_in_row(a, i) for i in range(n)]
col_sums = [get_sum_in_col(a, j) for j in range(n)]
n_ceils = 0
for row_sum in row_sums:
	for col_sum in col_sums:
		if col_sum > row_sum:
			n_ceils += 1
print(n_ceils)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
(cs, rs, ans) = ([0] * n, [0] * n, 0)
for i in range(n):
	rs[i] = sum(a[i])
	cs[i] = sum([a[j][i] for j in range(n)])
for i in range(n):
	for j in range(n):
		ans += cs[i] > rs[j]
print(ans)


n = int(input())
ans = 0
a = []
for y in range(n):
	a.append([int(x) for x in input().split()])
for x in range(n):
	for y in range(n):
		s = 0
		for z in range(n):
			s += a[z][y]
		if s > sum(a[x]):
			ans += 1
print(ans)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
aa = []
bb = []
for i in l:
	aa.append(sum(i))
for i in zip(*l):
	bb.append(sum(i))
aa.sort()
bb.sort()
print(sum((i > j for i in bb for j in aa)))


(n, A) = (int(input()), [])
for i in range(n):
	A.append([int(x) for x in input().split()])
print(sum((1 for i in range(n) for j in range(n) if sum(A[i]) < sum(list(zip(*A))[j]))))


n = int(input())
rows = [list(map(int, input().split())) for x in range(n)]
columns = [[x[y] for x in rows] for y in range(n)]
a = 0
for x in range(n):
	b = sum(rows[x])
	for y in range(n):
		if sum(columns[y]) > b:
			a += 1
print(a)


n = int(input())
cage = [list(map(int, input().split())) for i in range(n)]
sumstring = 0
wincage = 0
new = [[0 for i in range(n + 1)] for j in range(n)]
for i in range(n):
	for j in range(n):
		sumstring += cage[j][i]
	new[i][1] = sumstring
	sumstring = 0
	new[i][0] = sum(cage[i])
for i in range(n):
	for j in range(n):
		if new[i][1] > new[j][0]:
			wincage += 1
print(wincage)


n = int(input())
m = []
for i in range(n):
	m.append(list(map(int, input().split())))
ans = 0
for i in range(n):
	for j in range(n):
		t = 0
		for k in range(n):
			t += m[k][j]
		if t > sum(m[i]):
			ans += 1
print(ans)


n = int(input())
ac = [0] * n
ar = []
for i in range(n):
	a = list(map(int, input().split()))
	ar.append(sum(a))
	for j in range(n):
		ac[j] += a[j]
c = 0
for i in range(n):
	for j in range(n):
		if ar[i] < ac[j]:
			c += 1
print(c)


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')
	l = [[int(x) for x in i.split()] for i in inp[1:]]
	h = [sum(i) for i in l]
	v = [sum(i) for i in zip(*l)]
	return sum((i > j for i in v for j in h))
print(main())


x = int(input())
n = []
for i in range(x):
	m = input().split()
	for a in range(len(m)):
		m[a] = int(m[a])
	n.append(m)
c = 0
for i in range(x):
	sr = sum(n[i])
	for j in range(x):
		sc = 0
		for k in range(x):
			sc += n[k][j]
		if sc > sr:
			c += 1
print(c)


n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		hor = 0
		ver = 0
		for k in range(n):
			hor += arr[i][k]
			ver += arr[k][j]
		ans += ver > hor
print(ans)


n = int(input())
a = [[*map(int, input().split())] for _ in [0] * n]
b = [*zip(*a)]
r = 0
for i in range(n):
	for j in range(n):
		if sum(b[j]) > sum(a[i]):
			r += 1
print(r)


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
a1 = [sum(line) for line in a]
a2 = [sum((a[i][j] for i in range(n))) for j in range(n)]
k = 0
for i in a1:
	for j in a2:
		if j > i:
			k += 1
print(k)


n = int(input())
grid = []
for k in range(n):
	grid.append(list(map(int, input().split())))
res = 0
for i in range(n):
	for j in range(n):
		li = 0
		co = 0
		for k in range(n):
			li += grid[i][k]
			co += grid[k][j]
		if co > li:
			res += 1
print(res)


def colsum(matrix, col):
	ans = 0
	for i in range(len(matrix)):
		for j in range(len(matrix[0])):
			if j == col:
				ans += matrix[i][j]
	return ans

def rowsum(matrix, row):
	return sum(matrix[row])
cases = int(input())
mx = []
while cases:
	cases -= 1
	arr = list(map(int, input().split()))
	mx.append(arr)
ans = 0
for i in range(len(mx)):
	for j in range(len(mx[0])):
		if colsum(mx, i) > rowsum(mx, j):
			ans += 1
print(ans)


n = int(input())
l_row = []
for i in range(n):
	l = list(map(int, input().split()))
	l_row.append(l)
sum_row = []
sum_col = []
for i in l_row:
	sum_row.append(sum(i))
for i in range(len(l_row)):
	sumcol = 0
	for j in range(len(l_row[0])):
		sumcol += l_row[j][i]
	sum_col.append(sumcol)
count = 0
for i in range(len(sum_row)):
	for j in range(len(sum_col)):
		if sum_row[i] < sum_col[j]:
			count += 1
print(count)


import sys
n = int(input())
l = [0]
s = [0]
sum2 = [0]
for i in range(n):
	l1 = list(map(int, sys.stdin.readline().split()))
	s1 = sum(l1)
	s.append(s1)
	l = l + l1
for i in range(1, n + 1, 1):
	sum3 = 0
	for j in range(i, n * n + 1, n):
		sum3 += l[j]
	sum2.append(sum3)
total = 0
for i in range(1, n + 1):
	for j in range(1, n + 1):
		if sum2[j] > s[i]:
			total += 1
print(total)


n = int(input())
if n == 1:
	c = int(input())
	print('0')
else:
	arr = []
	row_sum = []
	col_sum = []
	for i in range(n):
		a = list(map(int, input().split()))
		arr.append(a)
		row_sum.append(sum(a))
	k = 0
	for i in range(n):
		c = 0
		for j in range(n):
			c += arr[j][k]
		k += 1
		col_sum.append(c)
	col_sum.sort(reverse=True)
	count = 0
	for i in range(n):
		for j in range(n - 1, -1, -1):
			if row_sum[i] < col_sum[j]:
				count += j + 1
				break
			else:
				continue
	print(count)


t = eval(input())
a = []
num = 0
for i in range(t):
	a.append(list(map(eval, input().split())))
for i in range(t):
	for j in range(t):
		s = 0
		for k in range(t):
			s += a[k][j]
		if s > sum(a[i]):
			num += 1
print(num)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
sr = []
for i in range(n):
	sr.append(sum(l[i]))
sc = []
for i in range(n):
	c = 0
	for j in range(n):
		c = c + l[j][i]
	sc.append(c)
c = 0
for i in sc:
	for j in sr:
		if i > j:
			c = c + 1
print(c)


A = [list(map(int, input().split())) for _ in range(int(input()))]
print(sum((h < v for h in map(sum, A) for v in map(sum, zip(*A)))))