#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>

using namespace std;

char field[13][13];

void dfs(int x, int y)
{
    field[x][y] = '0';
    if(field[x][y-1]=='1' && y-1>=0)
        dfs(x, y-1);
    if(field[x-1][y]=='1' && x-1>=0)
        dfs(x-1, y);
    if(field[x][y+1]=='1' && y+1<12)
        dfs(x, y+1);
    if(field[x+1][y]=='1' && x+1<12)
        dfs(x+1, y);

    return ;
}

int main(void)
{
    char unko;
    while(1) {
        int cnt = 0;
        for(int i=0; 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') {
                    dfs(i, j);
                    cnt++;
                }
            }
        }
        cout << cnt << endl;

        if(scanf("%c",&unko) == EOF) break;
    }
    return 0;
}