#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 * 20];
static int count;

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

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