#include<iostream>
#include<stdio.h>
using namespace std;

const int x[] = {-1,0,1,0};
const int y[] = {0,1,0,-1};
char m[14][14];
	
int a (int i,int j) {
	if (m[i][j] == '0') return 0;
	
	m[i][j]='0';
	for (int k=0;k<4;k++){
		int l = i - x[k],n = j - y[k];
		a (l,n);
	}
	
}

int main () {
	while(cin>>m[1][1]){
		int dummy = m[1][1];
		for (int i=0;i<14;i++){
			for (int j=0;j<14;j++){
				m[i][j] = '0';
			}
		}
		m[1][1] = dummy;
		
		for (int i=1;i<13;i++){
			for (int j=1;j<13;j++){
				if(!(i==1&&j==1)){
				cin>>m[j][i];
				}
			}
		}
		
		int count=0;
		for (int i=1;i<13;i++){
			for (int j=1;j<13;j++){
				if (m[i][j]=='1'){
					count++;
					a(i,j);
				}
			}
		}
		cout << count << endl;
	}
}