#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int grid[14][14];

void solve(){
    int ans = 0;
    array<int, 4> dx{-1, 1, 0, 0}, dy{0, 0, -1, 1};
    queue<pair<int, int>> Q;
    for (int i = 1; i <= 12; ++i) {
        for (int j = 1; j <= 12; ++j) {
            if(grid[i][j]){
                grid[i][j] = 0;
                ans++;
                Q.emplace(i, j);
                while(!Q.empty()){
                    int y, x; tie(y, x) = Q.front(); Q.pop();
                    for (int k = 0; k < 4; ++k) {
                        if(grid[y+dy[k]][x+dx[k]]){
                            grid[y+dy[k]][x+dx[k]] = 0;
                            Q.emplace(y+dy[k], x+dx[k]);
                        }
                    }
                }
            }
        }
    }
    cout << ans << "\n";
}
int main() {
    fill_n((int*)grid, 196, 0);
    int cur = 0;
    string s;
    while(cin >> s){
        for (int i = 0; i < 12; ++i) {
            grid[cur+1][i+1] = s[i]-'0';
        }
        cur++;
        if(cur == 12) solve(), cur = 0;
    }
    return 0;
}
