//include---------------------------------------------------------------------------
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cctype>
#include<vector>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<bitset>
#include<map>
#include<algorithm>
#include<memory>

//using namespace-------------------------------------------------------------------
using namespace std;

//define,const----------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1 << 25;
#define MAX_N 100

//global----------------------------------------------------------------------------
int aboutmap[14][14];

//function--------------------------------------------------------------------------
void solve(int x, int y){
	aboutmap[x][y] = 0;
	if(aboutmap[x + 1][y])
		solve(x + 1, y);
	if(aboutmap[x][y + 1])
		solve(x, y + 1);
	if(aboutmap[x - 1][y])
		solve(x - 1, y);
	if(aboutmap[x][y - 1])
		solve(x, y - 1);
}
int main(){
	for(int i = 0; i < 14; i++){
		aboutmap[i][0] = 0;
		aboutmap[0][i] = 0;
		aboutmap[i][13] = 0;
		aboutmap[13][i] = 0;
	}
	while(scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d",
		&aboutmap[1][1], &aboutmap[1][2], &aboutmap[1][3], &aboutmap[1][4], &aboutmap[1][5], &aboutmap[1][6], 
		&aboutmap[1][7], &aboutmap[1][8], &aboutmap[1][9], &aboutmap[1][10], &aboutmap[1][11], &aboutmap[1][12]) != EOF){
			for(int i = 2; i < 13; i++)
				for(int j = 1; j < 13; j++)
					scanf("%1d", &aboutmap[i][j]);
			int ans = 0;
			for(int i = 1; i < 13; i++){
				for(int j = 1; j < 13; j++){
					if(aboutmap[i][j]){
						solve(i, j);
						ans++;
					}
				}
			}
			printf("%d\n", ans);
	}
	return 0;
}