#include<bits/stdc++.h>
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
char c[13][13];
void dfs(int x, int y) {
	c[x][y] = '0';
	rep(i, 4) {
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 12 && c[nx][ny] == '1') {
			dfs(nx, ny);
		}
	}
}
int main() {
	string buf;
	do {
		rep(i, 12)scanf("%s", c[i]);
		int cnt = 0;
		rep(i, 12)rep(j, 12)if (c[i][j] == '1') {
			dfs(i, j); cnt++;
		}
		cout << cnt << endl;
	} while (getline(cin, buf));
	return 0;
}