#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main(){
	string t[12];

	while (cin >> t[0]){
		for (int i = 1; i < 12; i++){
			cin >> t[i];
		}

		stack <int> s1, s2;
		int island = 0;

		for (int x = 0; x < 12; x++){
			for (int y = 0; y < 12; y++){
				if (t[x][y] == '1'){
					island++;
					s1.push(x);
					s2.push(y);
					while (!s1.empty()){
						int X = s1.top();
						int Y = s2.top();
						s1.pop();
						s2.pop();
						if (X != 11 && t[X + 1][Y] == '1'){
							s1.push(X + 1);
							s2.push(Y);
						}
						if (Y != 11 && t[X][Y + 1] == '1'){
							s1.push(X);
							s2.push(Y + 1);
						}
						if (X != 0 && t[X - 1][Y] == '1'){
							s1.push(X - 1);
							s2.push(Y);
						}
						if (Y != 0 && t[X][Y - 1] == '1'){
							s1.push(X);
							s2.push(Y - 1);
						}
						t[X][Y] = '0';
					}
				}
			}
		}

		cout << island << endl;
	}

	return 0;
}
