n=int(input())
list=[n*[n*[0]]]
for i in range(n):
    string=input()
    list.append(str.split(string))

for i in range(0,n):
    list[i]=list[i+1]
del list[i]

for i in range(n):
    for j in range(n):
        list[i][j]=int(list[i][j])


sum1=sum2=0
for i in range(n):
    for j in range(n):
        if((i+j)==(n-1)):
            sum1 = sum1 + list[i][j]
        if(i==j):
            sum2 = sum2 + list[i][j]

print(abs(sum1-sum2))


