#include <bits/stdc++.h>

using namespace std;

char field[13][13];
int dx[] = {-1, 0, 0, 1};
int dy[] = {0, -1, 1, 0};

void dfs(int x, int y) {
    field[x][y] = '0';

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

int main() {
    while (scanf("%s", field[0]) != EOF) {
        for (int i = 1; i < 12; i++)
            scanf("%s", field[i]);
        
        int cnt = 0;
        for (int i = 0; i < 12; i++) {
            for (int j = 0; j < 12; j++) {
                if (field[i][j] == '1') {
                    cnt++;
                    dfs(i, j);
                }
            }
        }

        cout << cnt << endl;
    }

    return 0;
}
