#include<iostream>
using namespace std;
char c[14][14];
void dfs(int i,int j) {
	c[i][j] = '0';
	if (i > 1 && c[i - 1][j] == '1')dfs(i - 1, j);
	if (i < 12 && c[i + 1][j] == '1')dfs(i + 1, j);
	if (j > 1 && c[i][j - 1] == '1')dfs(i, j - 1);
	if (j < 12 && c[i][j + 1] == '1')dfs(i, j + 1);
}
int main() {
	while (cin>>c[1]){
		for (int i = 2; i <= 12; i++)for (int j = 1; j <= 12; j++)cin >> c[i][j];
		int sum = 0;
		for (int i = 1; i <= 12; i++)for (int j = 1; j <= 12; j++) {
			if (c[i][j] == '1') {
				sum++;
				dfs(i, j);
			}
		}
		cout << sum << endl;
	}
}