#include<iostream>
#include<vector>
#include<string>
using namespace std;

char tisei[12][12];
void shima(int a, int b) {
	tisei[a][b] = 0;
	if (a > -1 && tisei[a - 1][b]) { shima(a - 1, b); }
	if (a<12 && tisei[a + 1][b]) { shima(a + 1, b); }
	if (b>-1 && tisei[a][b-1]) { shima(a, b-1);  }
	if (b<12 && tisei[a][b+1]) { shima(a , b+1); }
}
int main() {
	vector<int>o;
	while (1) {

		for (int a = 0; a < 12; a++) {
			string c;
			cin >> c;
			if (cin.fail())goto l;
			for (int b = 0; b < 12; b++) {
				tisei[a][b] = c[b] - 48;
			}
		}
		int s = 0;
		for (int e = 0; e < 12; e++) {
			for (int f = 0; f < 12; f++) {
				if (tisei[e][f]) { s++; shima(e, f); }
			}
		}
		o.push_back(s);
	}
l:;
	for (int u : o)cout << u << endl;
}