/*#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int s[10001];

int main(void)
{
	vector<int> s;
	int m,n;
	char h[10];
	while(1){
		scanf("%d %d",&m,&n);
		if(m == 0 && n == 0) break;
		for(int i=1;i<=m;i++){
			s.push_back(i);
		}
		for(int i=1;i<=n;i++){
			scanf("%s",h);
			if(i%3==0 && i%5==0 && (h[0] != 'F' || h[4] != 'B')){
				s.erase(s.begin() + (i-1)%m); //%s.size()
			}
			else if(i%3==0 && h[0]!='F'){
				//printf("3size %d\n",s.size());
				s.erase(s.begin() + (i-1)%m);
			}
			else if(i%5==0 && h[0]!='B'){
				//printf("5size %d\n",s.size());
				s.erase(s.begin() + (i-1)%m);
			}
		}
		for(int i=0;i<s.size();i++)
			printf("%d ",s[i]);
		printf("\n");
		s.clear();
	}
	return 0;
}
*/

/*#include<stdio.h>
int main(void)
{
	int n,n1,n2,k,prev[10],next[10];
	scanf("%d %d %d",&n,&n1,&n2);    //??°
	for(int i=0;i<n;i++){
		prev[i] = (i-1+n)%n;
		next[i] = (i+1)%n;
	}
	for(int i=0;i<n1;i++){
		scanf("%d",&k);
		next[prev[k]] = next[k];
		prev[next[k]] = prev[k];
		prev[k] = -1;
		next[k] = -1;
	}
	for(int i=0;i<n2;i++){
		scanf("%d",&k);
		if(prev[k] == -1)
			printf("-1\n");
		else
			printf("%d %d\n",prev[k],next[k]);
	}
	return 0;
}
*/

/*#include<stdio.h>
#include<string.h>
int OZAWA[21][21];
int main()
{
	int N,s[100],max=0;
	memset(s,0,sizeof(s));
	scanf("%d",&N);
	for(int i=0;i<N;i++)
		scanf("%d",&s[i]);
	OZAWA[0][s[0]]++;
	for(int i=0;i<N-2;i++){
		for(int j=0;j<21;j++){
			if(OZAWA[i][j] > 0){
				if(j + s[i+1]<= 20)
					OZAWA[i+1][j + s[i+1]] += OZAWA[i][j];
				if(j - s[i+1] >= 0)
					OZAWA[i+1][j - s[i+1]] += OZAWA[i][j];
			}
		}
	}
	for(int i=0;i<21;i++){
		if(max<OZAWA[i][s[N-1]])
			max = OZAWA[i][s[N-1]];
	}
	printf("%d\n",OZAWA[N-2][s[N-1]]);
	for(int i=0;i<20;i++){
		printf("%d |",s[i]);
		for(int j=0;j<20;j++){
			printf("%3d",OZAWA[i][j]);
		}
		printf("\n");
	}
	return 0;
}
*/

/*#include<stdio.h>
void dd(int,int,int);
int n,s,count=0;
int main(void)
{
	while(1){
		scanf("%d %d",&n,&s);
		if(n == 0 && s == 0) break;
		dd(0,0,0);
		printf("%d\n",count);
		count = 0;
	}
	return 0;
}

void dd(int a,int sum,int cnt)
{
	if(sum == s && cnt == n){
		printf("a=%d sum=%d cnt=%d\n",a,sum,cnt);
		count++;
		printf("-------\n");
	}
	if(a <10 && sum < s && cnt < n){
		//printf("%d %d %d\n",a,sum,cnt);
		dd(a+1,sum+a,cnt+1);
		dd(a+1,sum,cnt);
	}
}
*/


#include<stdio.h>
#include<iostream>
using namespace std;
char Island[12][12];
void CC(int,int);
//void show(void);
int main(void)
{
	int c;
	while(1){
		c = 0;
		for(int i=0;i<12;i++){
			cin >> Island[i];
		}
		if ( cin.eof() ) { break; }
		for(int i=0;i<12;i++){
			for(int j=0;j<12;j++){
				if(Island[i][j] == '1'){
					//printf("x:%d y:%d @\n",j,i);
					CC(i,j);
					c++;
					//show();
				}
			}
		}
		printf("%d\n",c);
	}
	return 0;
}

void CC(int y,int x)
{
	if(y>=0 && x>=0){
		//printf("delete x:%d y:%d\n",x,y);
		Island[y][x] = '0';
		if(Island[y-1][x] == '1') CC(y-1,x); //???
		if(Island[y+1][x] == '1') CC(y+1,x); //???
		if(Island[y][x-1] == '1') CC(y,x-1); //???
		if(Island[y][x+1] == '1') CC(y,x+1); //???
	}
}