#include <iostream>
#include <stack>
#include <map>

using namespace std;
#define loop(i,a,b) for(int i=a; i<(int)(b); i++)
#define rep(i,n) loop(i,0,n)

typedef pair<int, int> P;
const int dx[] = { 1, -1, 0, 0 };
const int dy[] = { 0, 0, 1, -1 };
char fie[12][13];

int main(){
    while (cin >> fie[0]){
        loop(i, 1, 12) cin >> fie[i];
        int n = 0;
        rep(i, 12)rep(j, 12){
            if (fie[j][i] == '1'){
                n++;
                stack<P> q;
                q.push(P(i, j));
                while (q.size()){
                    P s = q.top();
                    q.pop();
                    int x = s.first, y = s.second;
                    fie[y][x] = '0';
                    rep(i, 4){
                        int xx = x + dx[i], yy = y + dy[i];
                        if (fie[yy][xx] == '1') q.push(P(xx, yy));
                    }
                }
            }
        }
        cout << n << endl;
    }
}