#include <iostream>

#define N 12

std::string island[N];

void dfs( int i, int j ) {
    int dx[] = { -1,  0,  1,  0 };
    int dy[] = {  0, -1,  0,  1 };
    island[i][j] = '0';
    for (int k=0; k<4; ++k) {
        int x = i+dx[k], y = j+dy[k];
        if ( 0<=x && x<N && 0<=y && y<N && island[x][y] == '1' ) {
            dfs( x, y );
        }
    }
}

void solve() {
    unsigned int num = 0;
    for (int i=0; i<N; ++i) {
        for (int j=0; j<N; ++j) {
            if ( island[i][j] == '1' ) {
                ++num;
                dfs( i, j );
            }
        }
    }
    std::cout << num << std::endl;
}

int main() {
    while ( std::cin >> island[0] ) {
        for (int i=1; i<N; ++i) {
            std::cin >> island[i];
        }
        solve();
    }
    return 0;
}

