#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};
int table[12][12];
int cnt = 0;

void dfs(int x, int y){
    //cout << y << " " << x << endl;
    table[x][y] == 0;
    rep(i,4){
        int px = x + dx[i];
        int py = y + dy[i];
        if (px < 0 || px >= 12 || py < 0 || py >= 12) continue;
        if (table[py][px] == 0) continue;
        dfs(px, py);
    }
}
int main(){
    string str;
    while(1){
        rep(i,12){
            cin >> str;
            if (cin.eof()) return 0;
            rep(j,str.size()){
                table[i][j] = str[j]-'0';
            }
        }
        rep(i,12){
            rep(j,12){
                if(table[i][j] == 0) continue;
                dfs(j,i);
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

