#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

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

void dfs(int x, int y) {
	if (ground[y][x] == '0')
		return;
	ground[y][x] = '0';
	for (int i = 0; i < 4; i++) {
		int nx = x + dx[i];
		int ny = y + dy[i];
		if (0<=nx && nx<12 && 0<=ny && ny<12)
			if (ground[ny][nx] == '1')
				dfs(nx, ny);
	}
}

int main() {
	while (1) {
		int ans = 0;
		for (int i = 0; i < 12; i++)
			cin >> ground[i];
		for (int i = 0; i < 12; i++) {
			for (int j = 0; j < 12; j++) {
				if (ground[i][j] == '1') {
					dfs(j, i);
					ans++;
				}
			}
		}
		cout << ans << endl;
		if (cin.eof())
			break;
	}
	return 0;
}