#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

string field[12];
bool b[12][12];

int f(int x, int y){
	int dx[4] = {1, 0, -1, 0};
	int dy[4] = {0, 1, 0, -1};
	for(int i=0; i< 4; i++){
		int nx = x+dx[i], ny=y+dy[i];
		if(!(0 <= nx && nx < 12 && 0 <= ny && ny < 12)) continue;
		if(field[nx][ny] == '1' && b[nx][ny]){
			b[nx][ny] = false;
			f(nx, ny);
		}
	}
}

int main(){
	while(cin >> field[0]){
		int ret = 0;
		for(int i=0; i <12; i++) for(int j=0; j < 12;j++) b[i][j] = true;
		for(int i=1; i< 12; i++) cin >> field[i];
		for(int i=0; i<12; i++){
			for(int j=0; j < 12; j++){
				if(field[i][j] == '1' && b[i][j]){
					b[i][j] = false;
					f(i, j);
					ret++;
				}
			}
		}
		cout << ret << endl;
	}
}
#include <stdio.h>

int par[12 * 12]; // 島の座標の個数

void init(int n)
{
    for (int i = 0; i < n; i++){
        par[i] = i; // i 番目の頂点のグループは最初は i
    }
}

int find(int x)
{
    if (par[x] == x){
        return (x);
    }
    return (par[x] = find(par[x]));
}

void merge(int x, int y)
{
    x = find(x);
    y = find(y);
    
    if (x != y){
        par[y] = x;
    }
}

int same(int x, int y)
{
    return (find(x) == find(y));
}

int main(void)
{
    int i, j;
    int num;
    int groups[12 * 12];
    char island[13][13];
     
    while (1){
        
        //色々初期化
        num = 0;
        init(12 * 12);
        for (i = 0; i < 12 * 12; i++){
            groups[i] = 0;
        }
        for (i = 0; i < 13; i++){
            for (j = 0; j < 13; j++){
                island[i][j] = 0;
            }
        }
        
        //入力
        for (i = 0; i < 12; i++){
            if (scanf("%s", island[i]) == EOF){
                return (0);
            }
        }
        
        for (i = 0; i < 12; i++){
            for (j = 0; j < 12; j++){
                //001
                //001
                //...みたいな繋がり方
                if (island[i][j] == '1' && island[i + 1][j] == '1'){
                    merge(i * 12 + j, (i + 1) * 12 + j);
                }
                //011
                //...みたいな繋がり方
                if (island[i][j] == '1' && island[i][j + 1] == '1'){
                    merge(i * 12 + j, i * 12 + j + 1);
                }
            }
        }
        
        for (i = 0; i < 12; i++){
            for (j = 0; j < 12; j++){
                if (island[i][j] == '1'){
                    groups[find(i * 12 + j)] = 1;
                }
            }
        }
        
        for (i = 0; i < 12 * 12; i++){
            num += groups[i];
        }
        
        printf("%d\n", num);
    }
    
    return (0);
}