#include<iostream>
using namespace std;
char fld[12][12];
bool ans = 0;
void dfs(int x, int y)
{
	if (0 <= x&&x < 12 && 0 <= y&&y < 12) {
		if (fld[x][y] == '0')
		{
			return;
		}
		else
		{
			cout << x << " " << y << "\n";
			ans = 1;
			fld[x][y] = '0';
			dfs(x + 1, y);
			dfs(x, y + 1);
			dfs(x, y - 1);
			dfs(x - 1, y);
		}
	}
}
int main()
{
	int realans = 0;
	while (cin >> fld[0][0])
	{
		for (int i = 0; i < 12; i++)for (int j = 0; j < 12; j++)
		{
			cin >> fld[i][j];
		}
		for (int i = 0; i < 12; i++)for (int j = 0; j < 12; j++)
		{
			dfs(i, j);
			if (ans)realans++;
			/*if (ans)
			{
				for (int k = 0; k < 12; k++)
				{

					for (int l = 0; l < 12; l++)
					{
						{cout << fld[k][l] << " "; }
					}
					cout << endl;
				}
			}*/
			ans = 0;


		}
	}
	cout << realans << endl;
}
