// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
#define N 12

bool dfs(int i, int j, int** A, int** use){
    if(use[i][j]==1)return false;
    use[i][j] = true;
    if(A[i][j]==0)return false;
    //----------
    if(i+1<N){        
        dfs(i+1, j, A, use);
    }
    if(i-1>=0){        
        dfs(i-1, j, A, use);
    }
    if(j+1<N){        
        dfs(i, j+1, A, use);
    }
    if(j-1>=0){        
        dfs(i, j-1, A, use);
    }
    return true;
}

int main()
{   while(true){
    string str[N];
    int i,j;
    int** A;
    int** use;
    A = (int**)malloc(N*sizeof(int*));
    A[0] = (int*)malloc(N*N*sizeof(int));
    for(i=0; i<N; i++){
        A[i] = A[0] + i*N;
    }
    use = (int**)malloc(N*sizeof(int*));
    use[0] = (int*)malloc(N*N*sizeof(int));
    for(i=0; i<N; i++){
        use[i] = use[0] + i*N;
    }
    for(i=0; i<N; i++){
        for(j=0; j<N; j++){
            A[i][j] = 0;
            use[i][j] = 0;
        }
    }
    
    for(i=0; i<N; i++){
        if(!(cin >> str[i]))return 0;
        for(j=0; j<N; j++){
            A[i][j] = '1' == str[i][j];
        }
    }
    
    int count = 0;
    for(i=0; i<N; i++){
        for(j=0; j<N; j++){
            count += dfs(i, j, A, use);
        }
    }
    cout << count << endl;
    }    
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/

