#include<stdio.h>
char Island[12][12];
void CC(int,int);
//void show(void);
int main(void)
{
	int c=0;
	while(1){
	for(int i=0;i<12;i++){
		if(scanf("%s",Island[i])==EOF) break;
	}
	
	for(int i=0;i<12;i++){
		for(int j=0;j<12;j++){
			if(Island[i][j] == '1'){
				//printf("x:%d y:%d @\n",j,i);
				CC(i,j);
				c++;
				//show();
			}
		}
	}
	printf("%d\n",c);
	}
	return 0;
}

void CC(int y,int x)
{
	if(y>=0 && x>=0){
		//printf("delete x:%d y:%d\n",x,y);
		Island[y][x] = '0';
		if(Island[y-1][x] == '1') CC(y-1,x); //???
		if(Island[y+1][x] == '1') CC(y+1,x); //???
		if(Island[y][x-1] == '1') CC(y,x-1); //???
		if(Island[y][x+1] == '1') CC(y,x+1); //???
	}
}