#include<iostream>
#include<stack>
#include<string>
using namespace std;
int main(){
	string s[12];
	while (cin >> s[0]){
		for (int i = 1; i < 12; i++)
		{
			cin >> s[i];
		}
		stack<int>s1, s2;
		int shima = 0;
		for (int y = 0; y < 12; y++)
		{
			for (int x = 0; x < 12; x++)
			{
				if (s[x][y] == '1')
				{
					//cout << x << " " << y << endl;
					shima++;
					s1.push(x);
					s2.push(y);
					while (!s1.empty())
					{
						int X = s1.top();
						int Y = s2.top();
						s1.pop();
						s2.pop();
						//X+1 Y
						//X-1 Y
						//X Y+1
						//X Y-1

						if (X + 1 < 12 && s[X + 1][Y] == '1')
						{
							s1.push(X + 1);
							s2.push(Y);
						}
						if (0 <= X - 1 && s[X - 1][Y] == '1')
						{
							s1.push(X - 1);
							s2.push(Y);
						}
						if (Y + 1 < 12 && s[X][Y + 1] == '1')
						{
							s1.push(X);
							s2.push(Y + 1);
						}
						if (0 <= Y - 1 && s[X][Y - 1] == '1')
						{
							s1.push(X);
							s2.push(Y - 1);
						}
						s[X][Y] = 0;
					}
				}
			}
		}
		cout << shima << endl;
	}
	return 0;
}
