#include <iostream>
using namespace std;
int countIsland(char** world, int N);
void destroyIsland(char** world, int i, int j, int N);

int main (int argc, char* argv[])
{
    const int N = 12;

    // char world[12][12];
	char** world = new char*[N];
    for (int i = 0; i < N; i++) {
        world[i] = new char[N];
    }

    
    char tmp;
    while(cin >> tmp){
        world[0][0] = tmp;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                if(i == 0 & j == 0) continue;
                cin >> world[i][j];
                
            }
        }
        cout << countIsland(world, N) << endl;
    }
    
	return 0;
}

int countIsland(char** world, int N){
    int count = 0;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (world[i][j] == '1') {
                destroyIsland(world, i, j, N);
                count++;
            }
        }
    }
    return count;
}

void destroyIsland(char** world, int i, int j, int N){
    world[i][j] = '0';
    if(i > 0){
        if (world[i - 1][j] == '1') {
            destroyIsland(world, i - 1, j, N);
        }
    }
    
    if(j > 0){
        if (world[i][j - 1] == '1') {
            destroyIsland(world, i, j - 1, N);
        }
    }
    
    if(i < N - 1){
        if (world[i + 1][j] == '1') {
            destroyIsland(world, i + 1, j, N);
        }
    }
    
    if(j < N - 1){
        if (world[i][j + 1] == '1') {
            destroyIsland(world, i, j + 1, N);
        }
    }
    
}