#include <iostream>
#include <string>

using namespace std;

const int dx[] = {0, 1, 0, -1};
const int dy[] = {-1, 0, 1, 0};
const int s = 12;
string map[12];
int isl;

void dfs(int x, int y) 
{
    map[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 >= s || ny >= s)
            continue;
        else if (map[ny][nx] == '1')
            dfs(nx, ny);
    }
}

int main()
{
    string str;

    while (cin >> str) {
        map[0] = str;
        for (int i = 1; i < s; i++)
            cin >> map[i];
        
        isl = 0;
        for (int y = 0; y < s; y++) {
            for (int x = 0; x < s; x++) {
                if (map[y][x] == '1') {
                    isl++;
                    dfs(x, y);
                }
            }
        }
        cout << isl << endl;        
    }
    
    return 0;
}