#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int k, l=0;
for(int i=0;i<n;i++){
for(int j=0; j<n; j++){
cin >> k;
if(k)
l++;
}
}
cout << l << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGludCBrLCBsPTA7CiAgICBmb3IoaW50IGk9MDtpPG47aSsrKXsKICAgICAgICBmb3IoaW50IGo9MDsgajxuOyBqKyspewogICAgICAgICAgICBjaW4gPj4gazsKICAgICAgICAgICAgaWYoaykKICAgICAgICAgICAgbCsrOwogICAgICAgIH0KICAgIH0KICAgIGNvdXQgPDwgbCA8PCBlbmRsOwoKICAgIHJldHVybiAwOwp9