#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int a[n][n];
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
cin>>a[i][j];
int k=0;
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
if(a[i][j]==1) k++;
cout<<k;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpIHsKCWludCBuOwoJY2luPj5uOwoJaW50IGFbbl1bbl07Cglmb3IoaW50IGk9MDsgaTxuOyBpKyspCgkJZm9yKGludCBqPTA7IGo8bjsgaisrKQoJCQljaW4+PmFbaV1bal07CglpbnQgaz0wOwoJZm9yKGludCBpPTA7IGk8bjsgaSsrKQoJZm9yKGludCBqPTA7IGo8bjsgaisrKQoJCWlmKGFbaV1bal09PTEpIGsrKzsKCWNvdXQ8PGs7CgkKfQ==