#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int S = 12;
int map[S][S] = {0};

void fillMap(int x, int y) {
    if ((x < 0) || (y < 0) || (map[x][y] != 1)) {
        return;
    }

    map[x][y] = 2;
    fillMap(x - 1, y);
    fillMap(x + 1, y);
    fillMap(x, y + 1);
    fillMap(x, y - 1);
}

int main() {
    while (true) {
        for (int i = 0; i < S; ++i) {
            for (int j = 0; j < S; ++j) {
                char temp;
                if (!(cin >> temp)) return 0;
                map[i][j] = atoi(&temp);
            }
            cin.ignore();
        }

        int count = 0;
        for (int i = 0; i < S; ++i) {
            for (int j = 0; j < S; ++j) {
                if (map[i][j] == 1) {
                    fillMap(i, j);
                    count++;
                }
            }
        }

        cout << count << endl;
    }
}