// Author:PanDaoxi
#include <bits/stdc++.h>
using namespace std;
const int inf = 101;
int n, ans,
fx[5] = {0, -1, -1, 1, 1},
fy[5] = {0, -1, 1, -1, 1};
char a[inf][inf];
void dfs(int x, int y){
a[x][y] = '0';
for(int i=1; i<=4; i++){
int xx = x + fx[i],
yy = y + fy[i];
if(
xx >= 1 && xx <= n &&
yy >= 1 && yy <= n &&
a[xx][yy] == '1'
){
dfs(xx, yy);
}
}
}
int main(){
ios :: sync_with_stdio(false);
cin >> n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
cin >> a[i][j];
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(a[i][j] == '1'){
dfs(i, j);
ans++;
}
}
}
cout << ans;
return 0;
}
bzd哪里错了