#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <functional>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
constexpr long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;

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


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> s[0]) {
        rep(i,1,12) cin >> s[i];
        function<void(int,int)> dfs = [&](int i, int j) {
            s[i][j] = '0';
            REP(k,4) {
                int ny = i + dy[k], nx = j + dx[k];
                if(0 <= ny && ny < 12 && 0 <= nx && nx < 12 && s[ny][nx] == '1') dfs(ny, nx);
            }
        };

        int ans = 0;
        REP(i,12) {
            REP(j,12) {
                if(s[i][j] == '1') {
                    dfs(i, j);
                    ++ans;
                }
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

