import std.stdio,std.string,std.conv;

char c[12][12]; 
int dx[4] = [1,0,-1,0];
int dy[4] = [0,1,0,-1];

void dfs(int x,int y)
{
	c[x][y] = '0';

	foreach(i;0..4)
	{
		int nx = x + dx[i];
		int ny = y + dy[i];

		if(0 <= nx && nx < 12 && 0 <= ny && ny < 12)
		{
			if(c[nx][ny] == '1')
			{
				dfs(nx,ny);
			}
		}
	}
}


int main()
{
	string s;
	string s2;
	bool flag = true;
	while(true)
	{
		if(flag)
		{
			s = readln.chomp;
			c[0] = s;
			foreach(i;1..12)
			{
				s = readln.chomp;
				c[i] = s;
			}
			flag = false;
		}
		else
		{
			s = readln.chomp;
			s2 = readln.chomp;
			if(s2.length == 0)
			{
				return 0;
			}
			else
			{
				c[0] = s2;
				foreach(i;1..12)
				{
					s = readln.chomp;
					c[i] = s;
				}
			}
		}

		int count = 0;

		foreach(i;0..12)
		{
			foreach(j;0..12)
			{
				if(c[i][j] == '1')
				{
					dfs(i,j);
					count++;
				}
			}
		}

		count.writeln;
	}
	return 0;
}