#include <iostream>
#include <cstdio>
#define n 12

using namespace std;

int main(){
	int a[n][n];
	while(scanf("%1d",&a[0][0])!=EOF){
		for(int i=1;i<n;i++) scanf("%1d",&a[0][i]);
		for(int j=1;j<n;j++) for(int i=0;i<n;i++) scanf("%1d",&a[j][i]);
		int b[n][n];
		for(int j=0;j<n;j++){
			for(int i=0;i<n;i++){
				if(a[i][j]==0) continue;
				for(int k=0;k<n;k++) for(int l=0;l<n;l++) b[k][l] = 0;
				b[i][j] = 1;
				if(i>0 and a[i-1][j]==1) b[i-1][j] = 2;
				if(j>0 and a[i][j-1]==1) b[i][j-1] = 2;
				if(i<n-1 and a[i+1][j]==1) b[i+1][j] = 2;
				if(j<n-1 and a[i][j+1]==1) b[i][j+1] = 2;
				int c = 2;
				while(1){
					bool out = true;
					for(int k=0;k<n;k++){
						for(int l=0;l<n;l++){
							if(b[k][l]!=c) continue;
							if(k>0 and a[k-1][l]==1 and b[k-1][l]==0){ b[k-1][l] = c+1; out = false; }
							if(l>0 and a[k][l-1]==1 and b[k][l-1]==0){ b[k][l-1] = c+1; out = false; } 
							if(k<n-1 and a[k+1][l]==1 and b[k+1][l]==0){ b[k+1][l] = c+1; out = false; }
							if(l<n-1 and a[k][l+1]==1 and b[k][l+1]==0){ b[k][l+1] = c+1; out = false; }
						}
					}
					c++;
					if(out) break;
				}
				for(int k=0;k<n;k++) for(int l=0;l<n;l++) if(b[k][l]>1) a[k][l] = 0;
			}
		}
		int c = 0;
		for(int j=0;j<n;j++) for(int i=0;i<n;i++) c += a[i][j];
		cout << c << endl;
	}
}