#include <iostream>
#include <vector>

using namespace std;

const int W = 12, H = 12;
vector<string> field;

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

void mark(int x, int y) {
    if (field[y][x] == '1') field[y][x] = '0';
    for (int i = 0; i < 4; i++) {
        int nx = x + dx[i], ny = y + dy[i];
        if (nx < 0 || ny < 0 || nx >= W || ny >= H) continue;
        if (field[ny][nx] == '0') continue;
        mark(nx, ny);
    }
}

int main() {
    field = vector<string>(12);

    string line;
    while(cin >> line) {
        field[0] = line;
        for (int i = 1; i <= 11; i++) {
            cin >> field[i];
        }

        int cnt = 0;
        for (int i = 0; i < field.size(); i++) {
            for (int j = 0; j < field[i].size(); j++) {
                if (field[i][j] == '1') {
                    cnt++;
                    mark(j, i);
                }
            }
        }
        cout << cnt << endl;
    }

    return 0;
}

