#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> Pair;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

int island[14][14];
bool went[14][14];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

int main() {
    while(1) {
        string temp[12];
        REP(i, 12) if(!(cin >> temp[i])) return 0;
        FOR(i, 1, 13) {
            FOR(j, 1, 13) {
                if(temp[i - 1][j - 1] == '1') island[i][j] = 1;
            }
        }
        queue<Pair> q;
        ll ans = 0;
        FOR(i, 1, 13) FOR(j, 1, 13) {
            if(island[i][j]) {
                q.push({i, j});
                island[i][j] = 0;
                while(!q.empty()) {
                    Pair now = q.front();
                    q.pop();
                    REP(i, 4) {
                        if(island[now.first + dx[i]][now.second + dy[i]]) {
                            q.push({now.first + dx[i], now.second + dy[i]});
                            island[now.first + dx[i]][now.second + dy[i]] = 0;
                        }
                    }
                }
                ans++;
            }
        }
        cout << ans << "\n";
    }
}

