#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<complex>
using namespace std;

char m[14][14]={0};
int w[4][2]={{-1,0},{1,0},{0,-1},{0,1}};

void sol(int i,int j) {
    int ni,nj;
    m[i][j]=='0';
    for(int k=0;k<4;++k) {
        ni=i+w[k][0];
        nj=j+w[k][1];
        if(m[ni][nj]=='1') sol(ni,nj);
    }
}

int main(){
    int ans;
    for (;;) {
        ans=0;
        for (int i=1;i<=12;++i) {
            if (scanf("%s",&m[i][1])==EOF) return 0;
        }

        for (int i=1;i<=12;++i) {
            for (int j=1;j<=12;++j) {
                if (m[i][j]=='1') {
                    sol(i,j);
                    ans++;
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}