#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

vector<string> R;
int dxy[5] = {-1, 0, 1, 0, -1};

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

    for (int i = 0; i < 4; ++i)
    {
        int ny = y + dxy[i], nx = x + dxy[i + 1];
        if (nx >= 0 && nx < 12 && ny >= 0 && ny < 12 && R[ny][nx] == '1')
        {
            dfs(ny, nx);
        }
    }
}
int solve()
{
    int ans = 0;
    for (int i = 0; i < 12; ++i)
    {
        for (int j = 0; j < 12; ++j)
        {
            if (R[i][j] == '1')
            {
                dfs(i, j);
                ans++;
            }
        }
    }
    return ans;
}
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);

    while (true)
    {
        R = vector<string>(12);

        for (int i = 0; i < 12; i++)
        {
            if (!(cin >> R[i]))
            {
                return 0;
            }
        }

        cout << solve() << endl;
    }
    return 0;
}
