import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto field = new char[14][14];
		field[0][] = '0';
		field[$-1][] = '0';
		foreach (i; 1..13) {
			field[i][] = '0';
			auto str = readln.chomp;
			foreach (j; 1..13) {
				field[i][j] = str[j-1];
			}
		}
		int cnt;
		foreach (i; 1..13) {
			foreach (j; 1..13) {
				if (field[i][j] == '0') continue;
				void solve(int x, int y) {
					field[x][y] = '0';
					for (int i = -1; i <= 1; i+=2) {
						if (field[x][y+i] == '1')
							solve(x, y+i);
						if (field[x+i][y] == '1')
							solve(x+i, y);
					}
				}
				cnt++;
				solve(i,j);
			}
		}
		cnt.writeln;
		if (!readln) break;
	}
}