#include <iostream>
#include <string>
using namespace std;

int island[12][12];

void drow(int x, int y);
	

int main()
{
	int sima = 0;
	string str;

	while(1)
	{
		for(int i = 0; i < 12; i++)
		{
			cin >> str;
			for(int j = 0; j < 12; j++)
			{
				if(str[j] == '1')
				{
					island[i][j] = 1;
				}
			
				else
				{
					island[i][j] = 0;
				}
			}
		}
		if (cin.eof()) 
		{
			break;
		}
		
	
		for(int i = 0; i < 12; i++)
		{
			for(int j = 0; j < 12; j++)
			{
				if(island[i][j] == 1)
				{
					sima = sima + 1;
					
					drow(i , j);
					
				}	
			}
		}
		
		cout << sima << endl;
		sima = 0;
	}
	
	return 0;
}

void drow(int x, int y)
{
	island[x][y] = 0;
	
	if(island[x - 1][y] == 1 && x - 1 >= 0)
	{
		drow((x - 1), y);
	}
	
	if(island[x + 1][y] == 1 && x + 1 <= 11)
	{
		drow((x + 1), y);
	}
	
	if(island[x][y - 1] == 1 && y - 1 >= 0)
	{
		drow( x, (y - 1));
	}
	
	if(island[x][y + 1] == 1 && y + 1 <=11)
	{
		drow( x, (y + 1));
	}
}