#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<string.h>
#include<math.h>

using namespace std;



int main(){
    string in[12];
    while(cin>>in[0]){
        for(int i=1; i<12; i++){
            cin>>in[i];
        }
        int count = 0;
        for(int i=0; i<12; i++){
            for(int j=0; j<12; j++){
                if(in[i][j]=='1'){
                    count++;
                    pair<int, int> now;
                    now.first = i; now.second = j;
                    queue<pair<int, int> > qu;
                    qu.push(now);
                    in[now.first][now.second]='0';
                    while(!qu.empty()){
                        pair<int, int> top;
                        top = qu.front();
                        qu.pop();
                        if(top.first+1<12&&in[top.first+1][top.second]=='1'){
                            now.first=top.first+1;
                            now.second=top.second;
                            qu.push(now);
                            in[now.first][now.second]='0';
                        }
                        if(top.second+1<12&&in[top.first][top.second+1]=='1'){
                            now.first=top.first;
                            now.second=top.second+1;
                            qu.push(now);
                            in[now.first][now.second]='0';
                        }
                        if(top.first-1>=0&&in[top.first-1][top.second]=='1'){
                            now.first=top.first-1;
                            now.second=top.second;
                            qu.push(now);
                            in[now.first][now.second]='0';
                        }
                        if(top.second-1>=0&&in[top.first][top.second-1]=='1'){
                            now.first=top.first;
                            now.second=top.second-1;
                            qu.push(now);
                            in[now.first][now.second]='0';
                        }
                    }
                }
                
            }
        }
        cout<<count<<endl;
        
//        for(int i=0; i<12; i++){
//            cout<<in[i]<<endl;
//        }

    }
}