#include <stdio.h>

char a[13][13];
int count;
int dx[] = {0, 0, 1, -1};
int dy[] = {-1, 1, 0, 0};

void lake(int i, int j)
{
	int newx, newy;
	int k;
	
	a[i][j] = '0';
	
//	if (a[i][j] == '1'){
		for (k = 0; k < 4; k++){
			newx = i + dx[k];
			newy = j + dy[k];
			
			if (newx >= 0 && newy >= 0 && newx < 12 && newy < 12 && a[newx][newy] == '1'){
				lake(newx, newy);
			}
		}
//	}
}

int main(void)
{
	int i, j;
	
	while (1){
		for (i = 0; i < 12; i++){
			if (scanf("%s", a[i]) == EOF){
				return (0);
			}
		}
		
		for (i = 0; i < 12; i++){
			for (j = 0; j < 12; j++){
				if (a[i][j] == '1'){
					lake(i, j);
					
					count++;
				}
			}
		}
		
		printf("count = %d\n", count);
		count = 0;
	}
}