#include <iostream>
#include <string.h>

using namespace std;
int dx[4] = {-1, 0, 1,  0};
int dy[4] = { 0, 1, 0, -1};
char field[14][14];


void DFS(int y, int x)
{
	field[y][x] = '0';
	for(int i = 0; i < 4; ++i)
	{
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(field[ny][nx] == '1')
		{
			DFS(ny, nx);
		}
	}
}

void solve()
{
	memset(field, 0, sizeof(field));
	while(cin >> field[1][1])
	{
		for(int i = 2; i < 13; ++i)
		{
			cin >> field[1][i];
		}
		for(int i = 2; i < 13; ++i)
		{
			for(int j = 1; j < 13; ++j)
			{
				cin >> field[i][j];
			}
		}
		int count = 0;
		for(int i = 1; i < 13; ++i)
		{
			for(int j = 1; j < 13; ++j)
			{
				if(field[i][j] == '1')
				{
					++count;
					DFS(i, j);
				}
			}
		}
		cout << count << endl;
	}
}

int main()
{
	solve();
	return(0);
}