#include "bits/stdc++.h"
#include<string>
#include<sstream>
using namespace std;
int data[12][12];
vector<string> s(12);
int dx[] = { 1, 0, -1, 0 };
int dy[] = { 0, -1, 0, 1 };

void dfs(int x, int y) {
	s[y][x] = '0';
	for (int i = 0; i < 4; ++i) {
		int px = x + dx[i];
		int py = y + dy[i];
		if (px < 0 || px >= 12 || py < 0 || py >= 12)
			continue;
		if (s[py][px] == '0')
			continue;
		dfs(px, py);
	}
}

int main() {
	while (1) {
		int ans=0;

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