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

void dfs(int y, int x, vector<string>& v) {
    int dx[4] = {0, -1, 0, 1},
        dy[4] = {1, 0, -1, 0};
    for(int i=0; i<4; ++i) {
        int ny = y + dy[i], nx = x + dx[i];
        if(0 <= ny && ny < 12 && 0 <= nx && nx < 12 && v[ny][nx] == '1') {
            v[ny][nx] = '0';
            dfs(ny, nx, v);
        }
    }
}

int main() {
    vector<string> v(12);
    while(cin >> v[0]) {
        for(int i=1; i<12; ++i) {
            cin >> v[i];
        }
        int res = 0;
        for(int i=0; i<12; ++i) {
            for(int j=0; j<12; ++j) {
                if(v[i][j] == '1') {
                    res++;
                    dfs(i, j, v);
                }
            }
        }
        cout << res << endl;
    }
}
