#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<queue>
#include<algorithm>
#include<utility>
#include<vector>
#include<list>
using namespace std;
typedef pair<int, int> P;
int mx[4] = { 1,0,-1,0 }, my[4] = { 0,1,0,-1 };
vector<vector<int>>world(12, vector<int>(12,0));
void haba(int, int);
int main() {
	
	char ch;
	int ans;
	while (1) {
		ans = 0;
		for (int i = 0; i < 12; ++i) {
			for (int j = 0; j < 12; ++j) {
				scanf("%c", &ch);
				
				if (ch == '\n') {
					j--;
					continue;
				}
				if (ch!='0'&&ch!='1'||ch-'0'==EOF) break;
				world[j][i] = ch - '0';
			}
			if (ch != '0'&&ch != '1' || ch - '0' == EOF) break;
		}
		if (ch != '0'&&ch != '1' || ch - '0' == EOF) break;
		for (int i = 0; i < 12; ++i) {
			for (int j = 0; j < 12; ++j) {
				if (world[j][i] == 1) {
					haba( j, i);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}
void haba(int sx, int sy) {
	int res, nextx, nexty;
	pair<int, int> now;
	queue<P> que;
	que.push(P(sx, sy));
	while (que.size() != 0) {
		now = que.front();
		que.pop();
		world[now.first][now.second] = 0;
		int k = 0;
		for (int i = 0; i < 4; ++i) {
			if (now.first + mx[i] >= 0 && now.second + my[i] >= 0 && now.first + mx[i] < 12 && now.second + my[i] < 12 && world[now.first + mx[i]][now.second + my[i]] == 1) {
				que.push(P(now.first + mx[i], now.second + my[i]));
			}
				
		}
	}
	return;
}
