#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

int m1[12][12];
char m[12][12];
char t;

void foo(int a,int b){
	if(a<0||a>11||b<0||b>11) return;
	if(m1[a][b]==0) return;
	m1[a][b]=0;
	foo(a+1,b);
	foo(a-1,b);
	foo(a,b+1);
	foo(a,b-1);
}

int main(){
	while(cin>>m[0][0]){
		int res=0;
		//cout<<m[0][0]<<endl;
		rep(i,11) cin>>m[0][i+1];
		rep(i,11){
			rep(j,12){
				cin>>m[i+1][j];
			}
		}
		rep(i,12){
			rep(j,12){
				m1[i][j]=m[i][j]-'0';
			}
		}
		rep(i,12){
			rep(j,12){
				if(m1[i][j]==1){
					foo(i,j);
					res++;
				}
			}
		}
		cout<<res<<endl;
	}
	//cout<<0<<endl;
	return 0;
}