#include <iostream>
using namespace std;

char il[12][12];
int cnt;

void search(int x, int y){
	il[x][y] = 0;
	for(int dx = -1; dx <= 1; dx++){
		int nx = x + dx; int ny = y;
		if(0<=nx&&nx<=12&&0<=ny&&ny<=12&&il[nx][ny]=='1')	search(nx, ny);
	}

	for(int dy = -1; dy <= 1; dy++){
		int nx = x; int ny = y + dy;
		if(0<=nx&&nx<=12&&0<=ny&&ny<=12&&il[nx][ny]=='1')	search(nx, ny);	
	}
	return;
}

int main(){
	while(1){
		cnt = 0;
		for(int i = 0; i < 12; i++){
			for(int j = 0; j < 12; j++){
				cin >> il[i][j];
			}
		}

		for(int i = 0; i < 12; i++){
			for(int j = 0; j < 12; j++){
				if(il[i][j] == '1'){
					search(i, j);
					cnt++;
				}
			}
		}
		cout << cnt << endl;
	}
	
	return 0;
}