#include<iostream>
using namespace std;
/*
void disp(char **house,int w,int h){
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++)
			cout<<house[i][j]<<" ";
	cout<<endl;
	}
cout<<endl;
return;
}
*/

void aruku(char** house,int w,int h,int row,int col){
	if(house[col][row]=='0')return;
	house[col][row]='0';
	if(row+1<w)aruku(house,w,h,row+1,col);
	if(col+1<h)aruku(house,w,h,row,col+1);
	if(row-1>=0)aruku(house,w,h,row-1,col);
	if(col-1>=0)aruku(house,w,h,row,col-1);
return;
}

int tansaku( char** house,int w,int h){
	int row=0;int col=0;int cnt=0;
	for(int i=0;i<h;i++)
	for(int j=0;j<w;j++){
		if(house[i][j]=='1'){row=j;col=i;cnt++;
			aruku(house,w,h,row,col);
		}
	}
	return cnt;
}


int main(void){
int h=12,w=12;
	string next;
	do{
	char** house=(char**)calloc(h,sizeof(char*));
	for(int i=0;i<h;i++)house[i]=(char*)calloc(w,sizeof(char));

	for(int i=0;i<h;i++){
		string str;
		getline(cin,str);
		for(int j=0;j<w;j++){house[j][i]=str[j];}
	}
	
	//disp(house,w,h);
	int ret=tansaku(house,w,h);
	cout<<ret<<endl;
	for(int i=0;i<h;i++)free(house[i]);
	free(house);
	
	}while(getline(cin,next));
	
	return 0;
}

