#include <iostream>
#include <string>
#include <array>

using namespace std;

int const dir[][2] = {{1,0},{-1,0},{0,1},{0,-1}};
void clear( array<array<bool, 12>, 12>& f, int const i, int const j )
{
    if ( !f[i][j] )
        return;

    if ( i < 0 || j < 0 || i >= 12 || j >= 12 )
        return;

    f[i][j] = false;

    for( int ii=0; ii<4; ++ii ) {
        clear( f, i + dir[ii][0], j + dir[ii][1] );
    }
}

int main()
{
    for(;;) {
        array<array<bool, 12>, 12> f;
        string s;
        for( int iii=0; iii<12; ++iii ) {
            if ( !( cin >> s ) )
                return 0;

            for( int ii=0; ii<12; ++ii )
                f[iii][ii] = s[ii] == '1';
        }

        size_t sum = 0;
        for( int i=0; i<12; ++i ) {
            for( int j=0; j<12; ++j ) {
                if ( f[i][j] ) {
                    clear( f, i, j );
                    ++sum;
                }
            }
        }
        cout << sum << endl;
    }
}