#include<iostream>

bool field[12][12];

void dfs( int x, int y )
{
	field[y][x] = false;

	static const int dx[] = { 0, 1, 0, -1 }, dy[] = { -1, 0, 1, 0 };
	for( int d = 0; d != 4; ++d )
	{
		int nx = x + dx[d], ny = y + dy[d];

		if( nx < 0 || nx >= 12 || ny < 0 || ny >= 12 || !field[ny][nx] )
			continue;

		dfs( nx, ny );
	}

	return;
}

int main()
{
	while( true )
	{
		for( int i = 0; i != 12; ++i )
		{
			for( int j = 0; j != 12; ++j )
			{
				char c;
				if( !( std::cin >> c ) )
					goto end;
				field[i][j] = c - '0';
			}
		}

		int ans = 0;
		for( int i = 0; i != 12; ++i )
		{
			for( int j = 0; j != 12; ++j )
			{
				if( field[i][j] )
				{
					dfs( j, i );
					++ans;
				}
			}
		}

		std::cout << ans << std::endl;
	}

end:;

	return 0;
}