//aoj0067
#include<iostream>
using namespace std;

char isl[15][15];

void dfs(int x, int y) {
	isl[x][y] = '0';

	for (int i = -1; i <= 1; i += 2) {
		for (int j = -1; j <= 1; j += 2) {
			
			int a = x + i;
			int b = y + j;
			if (a >= 0 && b >= 0 && a < 12 && b < 12 && isl[a][b] == '1') {
				dfs(a, b);
			}
		}
	}
	return;
}

int main() {
	while (1) {
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				cin >> isl[i][j];
				if (isl[i][j] == EOF) { break; }
			}
		}

		int ca = 0;
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (isl[i][j] == '1') {
					dfs(i, j);
					ca++;
				}
			}
		}
		cout << ca << endl;
	}
	return 0;
}