#include <iostream>
#include <algorithm>

using namespace std;

int w, h, island;
char field[12][12];
//int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
//int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, -1, 0, 1};

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

    for (int i = 0; i < 4; i++)
    {
        int nx = x + dx[i];
        int ny = y + dy[i];

        if (nx < 0 || ny < 0 || nx > 12 || ny > 12)
            continue;

        if (field[ny][nx] == '1')
            dfs(nx, ny);
    }

    return;
}

int main()
{
    while (true)
    {
        island = 0;

        for (int y = 0; y < 12; y++)
        {
            for (int x = 0; x < 12; x++)
            {
                if(!(cin >> field[y][x])) return 0;
            }
        }

        for (int y = 0; y < 12; y++)
        {
            for (int x = 0; x < 12; x++)
            {
                if (field[y][x] == '1')
                {
                    dfs(x, y);
                    island++;
                }
            }
        }

        cout << island << endl;
    }

    return 0;
}