#include <iostream>

const int MAX_N = 100, MAX_M = 100;
int n,m;
char field[MAX_N][MAX_M + 1];

const char SOIL = '0', POND = '1';

void init()
{
    //std::cin >> n >> m;
    n = 12; m = 12;
    for(int i = 0; i < n; i++) for(int j = 0; j < m; j++)
    {
        if( i == 0 && j == 0 ){ continue; }
        std::cin >> field[i][j];
    }
}

void dfs(int i, int j)
{
    if( i < 0 || j < 0 || i >= n || j >= m ){ return; }
    if( field[i][j] == SOIL ){ return; }

    field[i][j] = SOIL;

    // 4近傍に探索
    dfs( i - 1, j );
    dfs( i + 1, j );
    dfs( i, j - 1 );
    dfs( i, j + 1 );
}

void view()
{
    std::cout << std::endl;
    for( int i = 0; i < n; i++ ) 
    {
        for( int j = 0; j < m; j++ )
        { std::cout << field[i][j]; }
        std::cout << std::endl;
    }
}

void solve()
{
    int pond_count = 0;

    // 池の部分を探す
    for( int i = 0; i < n; i++ ) for( int j = 0; j < m; j++ )
    {
        if( field[i][j] == POND )
        { 
            dfs( i, j );
            //view();
            pond_count++;
        }
    }
    std::cout << pond_count << std::endl;
}

int main()
{
    while( std::cin >> field[0][0] )
    {
        init();
        solve();
    }
}

