#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <list>
#include <functional>
#include <algorithm>
#include <array>


using namespace std;

void f(array<array<int,14>,14>& color,int i,int j){
    if(color[i][j] != 1) return;
    color[i][j] = -1;
    f(color,i+1,j);
    f(color,i-1,j);
    f(color,i,j+1);
    f(color,i,j-1);
}

int main(int, char**){
    char b;
    while(cin >> b){
	array<array<int,14>,14> map;
	map[1][1] = b == '1';
	for(int i(2);i<=12;++i){
	    cin >> b;
	    map[1][i] = b == '1';
	}
	for(int i(2);i<=12;++i)
	    for(int j(1);j<=12;++j){
		cin >> b;
		map[i][j] = b == '1';
	    }
	array<array<int,14>,14> color=map;
	// for(auto e: map){
	//     for(auto el: e){
	// 	cout << el;
	//     }
	//     cout << endl;
	// }
	int cnt(0);
	for(int i(1);i<=12;++i)
	    for(int j(1);j<=12;++j)
		if(color[i][j] == 1) {
			++cnt;
			f(color,i,j);
		}
	cout << cnt << endl;
	cin.ignore();
    }

    return 0;
}