#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

Pii search(vector<vector<int> > is){
    rep(i,12)rep(j,12){
        if (is[i+1][j+1]==1)
        {
            return make_pair(i+1,j+1);
        }
    }
    return make_pair(-1,-1);
}

void unionIsland(vector<vector<int> > &ismap,int num,Pii base){
    stack<Pii> st;
    st.push(base);
        while(!st.empty()){
            Pii f = st.top();st.pop();
            ismap[f.first][f.second]=num;
            if(ismap[f.first-1][f.second]==1){
                st.push(make_pair(f.first-1,f.second));
            }
            if(ismap[f.first+1][f.second]==1){
                st.push(make_pair(f.first+1,f.second));
            }
            if(ismap[f.first][f.second-1]==1){
                st.push(make_pair(f.first,f.second-1));
            }
            if(ismap[f.first][f.second+1]==1){
                st.push(make_pair(f.first,f.second+1));
            }
        }
}

int solve(){
    vector<vector<int> > ismap(14,vector<int> (14,0));
    int num = 1;
    rep(i,12){
        string tmp;
        if(!(cin>>tmp))return -1;
        rep(j,12){
            if(tmp[j]=='1') ismap[i+1][j+1]=1;
        }
    }

    Pii base = search(ismap);
    while (base.first != -1)
    {
        // cout<<base.first<<" "<<base.second<<endl; 
        num++;
        unionIsland(ismap,num,base);
        base = search(ismap);
    }
    

    return num-1;
}

int main(){
    rep(i,20){
        int tmp = solve();
        if (tmp ==-1) return 0;
        cout << tmp <<endl;
        
    }
    return 0;
}
