/*
	0067:The Number of Island
*/
#include	<iostream>
#include	<string>

using namespace std;

int field[12][12] = { 0 };

void draw(int x, int y);

int main(void) {
	string str;
	int c;
	while(1) {
		c = 0;
		for(int i = 0; i < 12; i++) {
			cin >> str;
			for(int j = 0; j < 12; j++) {
				if(str[j] == '1') {
					field[i][j] = 1;
				}
			}
		}
		if( cin.eof() ) {
			break;
		}
		for(int i = 0; i < 12; i++) {
			for(int j = 0; j < 12; j++) {
				if(field[i][j] == 1) {
					draw(i, j);
					c++;
				}
			}
		}
		cout << c << endl;
	}
}

void draw(int x, int y) {
	field[x][y] = 0;
	//上側検索
	if(field[x][y-1] == 1 && y != 0) {
		draw(x, y-1);
	}
	//下側検索
	if(field[x][y+1] == 1 && y != 11) {
		draw(x, y+1);
	}
	//右側検索
	if(field[x+1][y] == 1 && x != 11) {
		draw(x+1, y);
	}
	//左側検索
	if(field[x-1][y] == 1 && x != 0) {
		draw(x-1, y);
	}
}