#include<iostream>
using namespace std;

string field[12];

void solve( int x, int y ){
	field[y][x] = '0';
	if( x>0 && field[y][x-1]=='1' )
		solve( x-1, y );
	if( x<11 && field[y][x+1]=='1' )
		solve( x+1, y );
	if( y>0 && field[y-1][x]=='1' )
		solve( x, y-1 );
	if( y<11 && field[y+1][x]=='1' )
		solve( x, y+1 );
}

int main(){
	string in;
	do{
		for( int i=0; i<12; i++ ){
			getline(cin, field[i]);
		}
		int count = 0;
		for( int y=0; y<12; y++ ){
			for( int x=0; x<12; x++ ){
				if( field[y][x] == '1' ){
					solve( x, y );
					count++;
				}
			}
		}
		cout << count << endl;
	}while(getline(cin, in));
	return 0;
}