#include <cstring>
#include <queue>
#include <iostream>
using namespace std;

typedef pair<int, int> P;

int main(){
	string str;
	bool fld[12][12];
	bool start = false;
	int ans;
	queue<P> que;
	P p;
	int X, Y;
	
	while(getline(cin, str)){
		for(int j = 0; j < 12; j++){
			if(str[j] == '1'){
				fld[0][j] = true;
			}
			else{
				fld[0][j] = false;
			}
		}
		for(int i = 1; i < 12; i++){
			cin >> str;
			for(int j = 0; j < 12; j++){
				if(str[j] == '1'){
					fld[i][j] = true;
				}
				else{
					fld[i][j] = false;
				}
			}
		}
		
		ans = 0;
		for(int y = 0; y < 12; y++){
			for(int x = 0; x < 12; x++){
				if(fld[y][x]){
					ans++;
					
					que.push(P(x, y));
					fld[y][x] = false;
					while(!que.empty()){
						p = que.front(); que.pop();
						X = p.first; Y = p.second;
						
						if(X - 1 >= 0 && fld[Y][X - 1]){
							que.push(P(X - 1, Y));
							fld[Y][X - 1] = false;
						}
						if(Y - 1 >= 0 && fld[Y - 1][X]){
							que.push(P(X, Y - 1));
							fld[Y - 1][X] = false;
						}
						if(X + 1 < 12 && fld[Y][X + 1]){
							que.push(P(X + 1, Y));
							fld[Y][X + 1] = false;
						}
						if(Y + 1 < 12 && fld[Y + 1][X]){
							que.push(P(X, Y + 1));
							fld[Y + 1][X] = false;
						}
					}
				}
			}
		}
		
		cout << ans << endl;
		
		getline(cin, str);
	}
	
	return 0;
}