#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];

void dfs(int x, int y) {
	ground[y][x] = '0';
	int dx[4] = {0, 1, 0, -1};
	int dy[4] = {-1, 0, 1, 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[j][i] == '1') {
					dfs(i, j);
					ans++;
				}
			}
		}
		cout << ans << endl;
		if (cin.eof())
			break;
	}
	return 0;
}