#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int ild[12][12];

void erase_island(int i, int j, int (&ild)[12][12])
{
	ild[i][j] = -1;
	
	if(i - 1 >= 0){
		if(ild[i - 1][j] == 1)
			erase_island(i - 1, j, ild);
	}
	if(i + 1 < 12){
		if(ild[i + 1][j] == 1)
			erase_island(i + 1, j, ild);
	}
	if(j - 1 >= 0){
		if(ild[i][j - 1] == 1)
			erase_island(i, j - 1, ild);
	}
	if(j + 1 < 12){
		if(ild[i][j + 1] == 1)
			erase_island(i, j + 1, ild);
	}
}

int main()
{
	string str;
	int cont = 0;
	int i, j, k = 0;
	
	while(1)
	{
		if(k > 19)    break;
		
		for(i = 0; i < 12; i++){
			cin >> str;
			
			if(str[0] == EOF)    break;
			
			for(j = 0; j < 12; j++){
				ild[i][j] = (str[j] == '1')? 1: 0;
			}
		}
		
		if(str[0] == EOF)    break;
		
		for(i = 0; i < 12; i++){
			for(j = 0; j < 12; j++){
				if(ild[i][j] == 1){
					cont++;
					erase_island(i, j, ild);
				}
				else if(ild[i][j] == 0)
					ild[i][j] == -1;
			}
		}
		
		cout << cont << endl;
		
		cont = 0;
		k++;
	}
	
	return 0;
}