#include<iostream>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<queue>
#define REP(i,n) for(int i=0;i<(n);i++)
int dy[4] = { 1,0,-1,0 }, dx[4] = { 0,1,0,-1 };
static const int INF = 1 << 21;
using namespace std;
char field[12][12];

void dfs(int x, int y) {
	int nx, ny;
	field[x][y] = 0;
	REP(i, 4) {
		nx = x + dx[i]; ny = y + dy[i];
		if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 12 && field[nx][ny] == 1)dfs(nx, ny);
	
		
	}
}

void solve() {
	int res=0;
	REP(i, 12) {
		REP(j, 12) {
			if (field[i][j] == 1) {
				dfs(i, j);
					res++;
			}
		}
	}
	cout << res << endl;
}

int main() {
	REP(i, 12) {
		REP(j, 12) {
			cin >> field[i][j];
		}
	}
	solve();
	return 0;
}