#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
using namespace std;

#define REP(i,n) for(int i=0; i<n; i++)
#define RPA(i,s,e) for(int i=s; i<=e; i++)
#define RPD(i,s,e) for(int i=s; i>=e; i--)
#define PB(a) push_back(a)
#define MP(i,s) make_pair(i,s)
#define ALL(a) (a).begin(), (a).end()
#define PRT(a) cout << (a) << endl

typedef pair<int,int> P;

int M[12][12];
bool F[12][12];
char line[16];

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

void bfs(int y, int x) {
	queue<P> que;
	que.push(MP(y, x));
	F[y][x] = true;

	while(!que.empty()) {
		P p = que.front();
		que.pop();
		
		REP(k,4) {
			int xx = p.second + dx[k];
			int yy = p.first + dy[k];
			if(xx >= 0 && yy >= 0 && xx < 12 && yy < 12) {
				if(!F[yy][xx] && M[yy][xx] == 1) {
					F[yy][xx] = true;
					que.push(MP(yy, xx));
				}
			}
		}
	}
}

int solve() {
	memset(F, 0, sizeof(F));
	int cnt = 0;
	REP(i,12) {
		REP(j,12) {
			if(M[i][j] == 1 && !F[i][j]) {
				cnt++;
				bfs(i, j);
			}
		}
	}
	return cnt;
}

void coding() {
	while(scanf("%s", line) != EOF) {
		REP(j,12) {
			M[0][j] = line[j] - '0';
		}

		REP(i,11) {
			scanf("%s", line);
			REP(j,12) {
				M[i+1][j] = line[j] - '0';
			}
		}
		printf("%d\n", solve());
	}
}

//#define _LOCAL_TEST

int main() {
#ifdef _LOCAL_TEST
	freopen("a.in", "r", stdin);
#endif

	coding();

#ifdef _LOCAL_TEST
	cout << endl;
	cout << "This is local test" << endl;
	cout << "Do not forget to comment out _LOCAL_TEST" << endl;
#endif
}