#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

const double EPS = 1e-9;

void fill(int x, int y, int island[14][14]){
	if(island[x][y] == 0){
		return;
	}
	island[x][y] = 0;
	fill(x-1, y, island);
	fill(x, y-1, island);
	fill(x+1, y, island);
	fill(x, y+1, island);
}

int main(){
	int island[14][14] = {0};
	int n;
	string s;

	while(cin >> s){
		bool f = true;
		for(int i = 0; i < 12; i++){
			if(!f){
				cin >> s;
			}
			for(int j = 0; j < 12; j++){
				island[i+1][j+1] = s[j]-'0';
			}
			f = false;
		}

		int count = 0;
		for(int i = 1; i < 13; i++){
			for(int j = 1; j < 13; j++){
				if(island[i][j] == 1){
					fill(i, j, island);
					count++;
				}
			}
		}

		cout << count << endl;
		getline(cin, s);
	}

    return 0;
}