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

#define W 12
#define H 12

int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};
vector< vector<int> > map(W, vector<int>(H));

void rec(int x, int y)
{
	int xx, yy;
	int i;
	map[x][y] = 2;
	for (i = 0; i < 4; i++) {
		yy = y+dy[i];
		xx = x+dx[i];
		if (yy<0 || H<=yy || xx<0 || W<=xx) continue;
		if (map[xx][yy]!=1) continue;
		rec(xx, yy);
	}
}

int main()
{
	int count, i, j;
	char c;

	while ( cin.get(c) ) {
		map[0][0] = c-'0';
		for (i = 0; i < W; i++) {
			for (j = 0; j < H; j++) {
				if (i==0 && j==0) continue;
				cin.get(c);
				map[i][j] = c-'0';
			}
			cin.ignore(0xFF, '\n');
		}
		cin.ignore(0xFF, '\n');

		count = 0;
		for (i = 0; i < W; i++) {
			for (j = 0; j < H; j++) {
				if (map[i][j] != 1) continue;
				count++;
				rec(i, j);
			}
		}
		cout<<count<<endl;
	}

	return 0;
}