#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int map[14][14];
void dfs(int x,int y)
{
	map[x][y]=0;
	if(map[x-1][y]==0&&map[x][y+1]==0&&map[x+1][y]==0&&map[x][y-1]==0)
	{
		return;
	}
	if(map[x-1][y])
	{
		dfs(x-1,y);
	}
	if(map[x][y+1])
	{
		dfs(x,y+1);
	}
	if(map[x+1][y])
	{
		dfs(x+1,y);
	}
	if(map[x][y-1])
	{
		dfs(x,y-1);
	}
}
int main()
{
	while(1)
	{
	string s;
	for(int i=1;i<=12;i++)
	{
		if(!(cin >> s))goto end;
		for(int j=1;j<=12;j++)
		{
			map[i][j]=(s[j-1]-'0');
		}
	}
	int ans=0;
	int p,q;
	while(1)
	{
		p=q=-1;
		bool up;
		for(int i=1;i<=12;i++)
		{
			for(int j=1;j<=12;j++)
			{
			        up=false;
				if(map[i][j]==1)
				{
					p=i;
					q=j;
					up=true;
					break;
				}
			}
			if(up)break;
		}
		if(p==-1&&q==-1)break;
		dfs(p,q);
		ans++;
	}
	cout << ans << endl;
	}
	end: ;
	return 0;
}