#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
int books[10010]={0};
int dp[10000][1000];

#define INF 999999
void dfs(int x,int y);
char stage[16][16];
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};
int main(){
    char x;
    bool f = ~false;
	while(1){
		for(int i = 0; i < 12; i++){
			scanf("%s",stage[i]);
		}
		int ans = 0;
		for(int i = 0; i < 12; i++){
			for(int j = 0; j < 12; j++){
				if(stage[i][j] == '1'){
                    dfs(j,i);
                    ans++;
				}
			}
		}
		printf("%d\n",ans);
		memset(stage,0,sizeof(stage));
		x = getchar();
		x = getchar();
		if(x == EOF)break;
	}
	return 0;
}
void dfs(int x,int y){
	stage[y][x] = '0';
	for(int i = 0; i < 4; i++){
		int nx = x + dx[i];
		int ny = y + dy[i];
		if(nx < 0 || nx > 11 || ny < 0 || nx > 11)continue;
		if(stage[ny][nx] == '1'){
            stage[ny][nx] = '0';
            dfs(nx , ny);
		}
	}
	return ;
}