import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
int [][] gr = new int [1001][1001];
Scanner in
= new Scanner
(System.
in); int n = in.nextInt();
int ans = 0;
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
gr[i][j] = in.nextInt();
}
}
for (int i=0; i<n; i++) {
int cnt = 0;
for (int j=0; j<n; j++) {
if (gr[i][j] == 1) cnt++;
}
if (cnt==1) ans++;
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJaW50IFtdW10gZ3IgPSBuZXcgaW50IFsxMDAxXVsxMDAxXTsgCgkJU2Nhbm5lciBpbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CgkJaW50IG4gPSBpbi5uZXh0SW50KCk7IAoJCWludCBhbnMgPSAwOyAKCQlmb3IgKGludCBpPTA7IGk8bjsgaSsrKSB7CgkJCWZvciAoaW50IGo9MDsgajxuOyBqKyspIHsKCQkJCWdyW2ldW2pdID0gIGluLm5leHRJbnQoKTsgCgkJCX0KCQl9CgkJZm9yIChpbnQgaT0wOyBpPG47IGkrKykgewoJCQlpbnQgY250ID0gMDsgCgkJCWZvciAoaW50IGo9MDsgajxuOyBqKyspIHsKCQkJCWlmIChncltpXVtqXSA9PSAxKSBjbnQrKzsKCQkJfQoJCQlpZiAoY250PT0xKSBhbnMrKzsKCQl9CgkJU3lzdGVtLm91dC5wcmludGxuKGFucyk7Cgl9Cn0=