#include <iostream>
#include <array>
using namespace std;
array<array<char,12>,12> maap;

void dfs(int x,int y){
	maap[x][y] = '0';
	int dx[]={0,-1,1,0},dy[]={1,0,0,-1};
	for (int i = 0; i < 4; i++) {
		int nx = x+dx[i] , ny = y+dy[i];
		if(nx >= 0 && nx < 12 && ny >= 0 && nx < 12 && maap[nx][ny] == '1')
			dfs(nx,ny);
	}
	return;
}

int main(){
	while (1) {
		for (auto& i : maap)
			for (auto& j : i){
				cin>>j;
				if(cin.eof())return 0;
			}
		int cnt = 0;
		for (int i = 0; i < 12; i++)
			for (int j = 0; j < 12; j++)
				if(maap[i][j] == '1'){
					dfs(i,j);
					cnt++;
				}
		cout<<cnt<<endl;
	}
	return 0;
}