#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector< vector<int> > a(n,vector<int>(n));
for(int a_i = 0;a_i < n;a_i++){
for(int a_j = 0;a_j < n;a_j++){
cin >> a[a_i][a_j];
}
}
int s1 = 0;
for(int i = 0; i < n; i++)
s1 += a[i][i];
int s2 = 0;
for(int i = 0; i < n; i++)
s2 += a[i][i];
cout << std::abs(s1 - s2) << endl;
return 0;
}
I2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKaW50IG1haW4oKXsKICAgIGludCBuOwogICAgY2luID4+IG47CiAgICB2ZWN0b3I8IHZlY3RvcjxpbnQ+ID4gYShuLHZlY3RvcjxpbnQ+KG4pKTsKICAgIGZvcihpbnQgYV9pID0gMDthX2kgPCBuO2FfaSsrKXsKICAgICAgIGZvcihpbnQgYV9qID0gMDthX2ogPCBuO2FfaisrKXsKICAgICAgICAgIGNpbiA+PiBhW2FfaV1bYV9qXTsKICAgICAgIH0KICAgIH0KICAgIGludCBzMSA9IDA7CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQogICAgICAgICAgICBzMSArPSBhW2ldW2ldOwogICAgaW50IHMyID0gMDsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgICAgIHMyICs9IGFbaV1baV07CiAgICBjb3V0IDw8IHN0ZDo6YWJzKHMxIC0gczIpIDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQ==