#include <cstdio>

#define MAX 13

char mapI[MAX][MAX];
const static int N = 12;
int move[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

void dfs(int x, int y) {
    int nx, ny;
    mapI[x][y] = '0';
    for (int i = 0; i < 4; i++) {
        nx = x + move[i][0]; ny = y + move[i][1];
        if (0 <= nx && N > nx && 0 <= ny && N > ny && mapI[nx][ny] == '1') dfs(nx, ny);
    }
    return;
}


int main()
{
    while(scanf("%s",mapI[0])!=EOF){
        for(int i = 1; i < 12; i++)scanf("%s",mapI[i]);
        int sum = 0;
        for(int i = 0 ; i < 12; i++){
            for(int j = 0; j < 12 ;j++){
                if(mapI[i][j] =='1'){
                    sum++;
                    dfs(i,j);
                }
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}

