#include <bits/stdc++.h>
using namespace std;

const int N = 12;
string S[N];
bool seen[N][N];
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};

struct UnionFind{
    vector<int> par;
    UnionFind(int N) : par(N){
        for(int i = 0; i < N; i++){
            par[i] = -1;
        }
    }
    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    void unite(int x, int y){
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        else{
            if(par[rx] > par[ry]) swap(rx, ry);
            par[rx] += par[ry];
            par[ry] = rx;
       }
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    void check(){
        for(auto x : par){
            cout << x << " ";
        }
        cout << endl;
    }
};

void dfs(int x, int y, UnionFind &uf){
    seen[x][y] = true;
    for(int i = 0; i < 4; i++){
        int nx, ny;
        nx = dx[i] + x;
        ny = dy[i] + y;
        if(nx < 0 or ny < 0 or nx >= N or ny >= N) continue;
        if(S[nx][ny] == '0' or seen[nx][ny]) continue;
        uf.unite(x * N + y, nx * N + ny);
        dfs(nx, ny, uf);
    }
    return;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    while(cin >> S[0]){
        UnionFind uf(N * N);
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                seen[i][j] = false;
                uf.par[i * N + j] = -1;
            }
        }
        for(int i = 1; i < N; i++){
            cin >> S[i];
        }

        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                if(!seen[i][j] and S[i][j] == '1'){
                    dfs(i, j, uf);
                }
            }
        }

        set<int> st;
        for(int i = 0; i < N; i++){
            for(int j = 0; j < N; j++){
                if(S[i][j] == '1') st.insert(uf.root(i * N + j));
            }
        }

        cout << st.size() << endl;

    }

    return 0;
}
