#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;

char a[100][100];
int c = 0;
int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 };
vector<int> vi;

void dfs(int x,int y){
	a[x][y] = '0';

	for (int i = 0; i < 4; i++){
		if (a[x + dx[i]][y + dy[i]] == '1'&&
			x+dx[i]>=0&&x+dx[i]<=11&&y+dy[i]>=0&&y+dy[i]<=11){
			dfs(x + dx[i], y + dy[i]);
		}
	}
	return;
}

int main(){
	while (1){
		if (cin.eof())break;
		REP(i, 12){
			REP(j, 12){
				cin >> a[i][j];
			}
		}
		REP(i, 12){
			REP(j, 12){
				if (a[i][j] == '1'){
					dfs(i, j);
					c++;
				}
			}
		}
		vi.push_back(c);
		c = 0;
	}
	REP(i, vi.size()){
		cout << vi[i] << endl;
	}
}