#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>


#define CI cin >>
#define CO cout <<
#define E << endl;
#define F(i,max) (for(int i = 0;i < max;++i))

using namespace std;

char board[14][14];
int vvv = 0;
int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int JudgeSurround(int x, int y) {
	board[x][y] = 0;
	for (int k = 0; k < 4; ++k) {
		int nx = x + dx[k];
		int ny = y + dy[k];

		if (nx < 1 || 13 <= nx) continue;
		if (ny < 1 || 13 <= ny) continue;
		if (board[nx][ny] == '0') {
			continue;
		}
		else {
			JudgeSurround(nx, ny);
		}
	}
}


int main(void) {
	int count = 0;
	bool flag = false;

	vector<int> answer;


	for (int i = 0; i < 14; ++i) {
		for (int j = 0; j < 14; ++j) {
			board[i][j] = 0;
		}
	}


	while (true) {
		count = 0;

		for (int i = 1; i < 13; ++i) {
			for (int j = 1; j < 13; ++j) {
				if (!(CI board[i][j])/*answer.size() == 2*/) {
					flag  = true;
				}
			}
		}

		for (int i = 1; i < 13; ++i) {
			for (int j = 1; j < 13; ++j) {
				if (vvv = 0, JudgeSurround(i, j) == 1) {
					count++;
				}
			}
		}

		CO count E

		if (flag == true) {
			return 0;
		}
	}

	return 0;
}