#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <sstream>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

void dfs(int w, int h, int x, int y, std::vector<std::string> &image){
	image[y][x] = '0';

	if(x >= 1 && image[y][x - 1] == '1'){
		dfs(w, h, x - 1, y, image);
	}
	if(x < w - 1 && image[y][x + 1] == '1'){
		dfs(w, h, x + 1, y, image);
	}
	if(y < h - 1 && image[y + 1][x] == '1'){
		dfs(w, h, x, y + 1, image);
	}

	return;
}

int main(int argc, char **argv){
	std::string buf;
	std::vector<std::string> image;
	int w = 12;
	int h = 12;
	int counter = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

	for(;;){
		image.clear();
		counter = 0;
		for(int i = 0; i < h; i++){
#if INPUT_FROM_FILE
			std::getline(ifs, buf);
#else
			std::getline(std::cin, buf);
#endif
			image.push_back(buf);
		}

		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				if(image[y][x] == '1'){
					counter++;
					dfs(w, h, x, y, image);
				}
			}
		}
		std::cout << counter << std::endl;

#if INPUT_FROM_FILE
		if(!std::getline(ifs, buf)){ break; }
#else
		if(!std::getline(std::cin, buf)){ break; }
#endif
	}

 
#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}
