#include <bits/stdc++.h>

using namespace std;

char island[12][13];

void solve(int row, int col) {
	int currentRow, currentCol;
	int dx[4] = { 0,1,0,-1 };
	int dy[4] = { 1,0,-1,0 };

	island[row][col] = 0;
	for (int i = 0; i < 4; i++) {
		currentRow = row + dx[i];
		currentCol = col + dy[i];

		if (currentRow < 0 || currentCol < 0 || currentCol > 11) {
			continue;
		}

		if (island[currentRow][currentCol] == '1') {
			solve(currentRow, currentCol);
		}
	}

}

int main(void) {
	int i,j,cnt;

	while (cin >> island[0]) {
		for (i = 1; i < 12; i++) {
			cin >> island[i];
		}
		
		cnt = 0;
		for (i = 0; i < 12; i++) {
			for (j = 0; j < 12; j++) {
				if (island[i][j] == '1') {
					cnt++;
					solve(i,j);
				}
			}
		}
		cout << cnt << endl;
	}

	return 0;
}
