#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool visited[12][12];

void dfs(int y,int x,char data[12][12]){
    if(data[y][x]=='0' ||y<0||x<0||y>=12||x>=12 )return;
    visited[y][x]=true;
    
    int d[]={-1,0,1,0,-1};
    rep(i,4){
        if( !(data[y+d[i]][x+d[i+1]]=='0' ||y+d[i]<0||x+d[i+1]<0||y+d[i]>=12||x+d[i+1]>=12) && visited[y+d[i]][x+d[i+1]]==false )
            dfs(y+d[i],x+d[i+1],data);
    }
}


int main(){
    string a;
    while(cin>>a){
        char data[12][12];
        int sum=0;
        rep(i,12)data[0][i]=a[i];
        for(int i=1;i<12;i++){
            cin>>data[i];
        }
        
        rep(i,12)rep(j,12)visited[i][j]=false;
        
        rep(i,12){
            rep(j,12){
                if( visited[i][j]==false && data[i][j]=='1' ){
                    dfs(i,j,data);
                    sum++;
                }
            }
        }
        cout<<sum<<endl;
    }
}