#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>

using namespace std;

queue<int> q;
list<int> l;
int *map = new int[12 * 12];
static int count;

void loop(int i, int j){
	map[i * 12 + j] = 0;
	if (i > 0) {
		if (map[(i - 1) * 12 + j] == 1) {
			l.push_front((i - 1) * 12 + j);
		}
	}
	if (i < 11) {
		if (map[(i + 1) * 12 + j] == 1) {
			l.push_front((i + 1) * 12 + j);
		}
	}
	if (j > 0) {
		if (map[i * 12 + j - 1] == 1) {
			l.push_front(i * 12 + j - 1);
		}
	}
	if (j < 11) {
		if (map[i * 12 + j + 1] == 1) {
			l.push_front(i * 12 + j + 1);
		}
	}
	l.unique();
	if (l.empty()) {
		return;
	}
	int front = l.front();
	l.pop_front();
	loop(front / 12, front % 12);
}

int main(int argc, char **argv)
{
	int k = 0;
	while (k < 20) {
		int count = 0;
		char c;
		for (int i = 0; i < 12 * 12 && cin >> c; i++) {
			map[i] = c - '0';
		}
		cin >> c;
		for (int i = 0; i < 12 * 12; i++) {
			if (map[i] == 1) {
				l.push_front(i);
				loop(i / 12, i % 12);
				count++;
			}
		}
		cout << count << endl;
		k++;
	}
}