#include<iostream>
#include<vector>
using  namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)

vector<vector<int> > map(14,vector<int> (14,0));
	int dx[]={1,-1,0,0 };
	int dy[]={0,0,1,-1 };
void dfs(int x,int y){
	map[x][y] =0;
	for(int i=0;i<4;i++){
		int nx = x+dx[i],ny = y+dy[i];
		if(map[nx][ny]==1)dfs(nx,ny);
	}
	return;
}
int main(){
	char a;
	while(cin>>a){
		map[1][1] =a-'0';
		for(int i=2;i<13;i++)cin>>a,map[1][i]=a-'0';
		rep(i,2,13)rep(j,1,13)cin>>a,map[i][j]=a-'0';
		int ans = 0;
		rep(i,1,13)rep(j,1,13){
		if(map[i][j]){
		ans++;
		dfs(i,j);
		}

		}
		cout<<ans<<endl;
	}

	return 0;

}

