#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 JudgeSurround(int x, int y) {
	if (board[x][y] == '0') {
		return vvv;
	}

	if (board[x][y] == '1') {
		board[x][y] = 0;
		vvv = 1;
		JudgeSurround(x + 1, y);
		JudgeSurround(x, y + 1);
		JudgeSurround(x - 1, y);
		JudgeSurround(x, y - 1);
		return vvv;
	}
}


int main(void) {
	int count = 0;

	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])) {
					break;
				}
			}
		}

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

		answer.push_back(count);
	}

	for (int i = 0; i < answer.size(); ++i) {
		CO answer[i] E
	}
	return 0;
}