#include <iostream>
#include <string>
#define H 12
#define W 12

using namespace std;

bool island[H][W];
bool arrived[H][W];

bool is_not_arrived(int x, int y) {
	if(x<0 || W<=x || y<0 || H<=y) return false;

	if(island[y][x] && !arrived[y][x]) {
		arrived[y][x] = true;
		is_not_arrived(x+1,y);
		is_not_arrived(x-1,y);
		is_not_arrived(x,y+1);
		is_not_arrived(x,y-1);
		return true;
	}

	return false;
}

int main() {
	while(true) {
		for(int i = 0; i < H; i++) {
			string s;
			cin >> s;
			for(int j = 0; j < H; j++) {
				island[i][j] = (s[j]=='1');
				arrived[i][j] = false;
			}
		}

		if(cin.eof()) break;

		int ans = 0;
		for(int i = 0; i < H; i++) {
			for(int j = 0; j < W; j++) {
				if(is_not_arrived(j,i)) {
					ans++;
				}
			}
		}

		cout << ans << endl;
	}
}

