#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int bfs(int stage[12][12]){

	int count = 0;
	for(int y=0;y<12;y++){
		for(int x=0;x<12;x++){
			if(stage[y][x]==1){
				count++;
				queue<P> que;
				que.push(P(x,y));

				while(!que.empty()){
					int x = que.front().first;
					int y = que.front().second;

					que.pop();

					stage[y][x] = 0;

					for(int i=-1;i<=1;i++){
						for(int j=-1;j<=1;j++){
							if(i*j != 0 || (i==j && i==0)) continue;
							int dx = x + i;
							int dy = y + j;

							if(dx >= 0 && dx < 12 && dy >= 0 && dy < 12){

								if(stage[dy][dx] == 1){
									que.push(P(dx,dy));
								}
							}

						}
					}
				}
			}
		}
	}
	return count;
}

int main(){
	string str;

	int stage[12][12];
	int y=0;
	while(getline(cin,str)){

		if(str.empty()){
			cout << bfs(stage) << endl;
			y=0;
			continue;
		}

		for(int i=0;i<12;i++){
			stage[y][i]=str[i]-'0';
		}
		y++;


	}

	cout << bfs(stage) << endl;
}