#include "bits/stdc++.h"
using namespace std;

int dx[4] = { 1, -1, 0, 0 }, dy[4] = { 0, 0, 1, -1 };
string S[12];

void DFS(int X, int Y) {
	S[X][Y] = '0';
	for (int i = 0; i < 4; i++) {
		int NX = X + dx[i], NY = Y + dy[i];
		if (0 <= NX && NX < 12 && 0 <= NY && NY < 12) {
			if (S[NX][NY] == '1') DFS(NX, NY);
		}
	}
}

int main() {
	while (cin >> S[0]) {
		int COUNT = 0;
		for (int i = 1; i < 12; i++) cin >> S[i];
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (S[i][j] == '1') {
					COUNT++;
					DFS(i, j);
				}
			}
		}
		cout << COUNT << endl;
	}
}
