#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<string> v(12);
const int mov[] = {-1, 0, 1, 0, -1};

void visit(int x, int y) {
    if (x < 0 || 12 <= x || y < 0 || 12 <= y || v[y][x] == '0') {
        return ;
    }
    v[y][x] = '0';
    for (int i = 0; i < 4; ++ i) {
        visit(x + mov[i], y + mov[i+1]);
    }
}

int main() {
    while ( ! cin.eof()) {
        for (int i = 0; i < 12; ++ i) cin >> v[i];

        int ans = 0;
        for (int y = 0; y < 12; ++ y) {
            for (int x = 0; x < 12; ++ x) {
                if (v[y][x] == '0') continue;
                visit(x, y);
                ++ ans;
            }
        }
        cout << ans << endl;
    }
    return 0;
}