#include<iostream>
#include<string>
#include<queue>
using namespace std;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int main()
{
	string f[12];
	while(cin>>f[0])
	{
		for(int i = 1; i < 12; ++i)
		{
			cin>>f[i];
		}
		int ans=0;
		for(int i = 0; i < 12; ++i)
		{
			for(int j = 0; j < 12; ++j)
			{
				if(f[i][j]=='1')
				{
					ans++;
					queue<int> xs,ys;
					xs.push(j); ys.push(i);
					f[i][j]='0';
					while(!xs.empty())
					{
						int x=xs.front(),y=ys.front();
						xs.pop(); ys.pop();
						for(int k = 0; k < 4; ++k)
						{
							int nx=x+dx[k],ny=y+dy[k];
							if(0<=nx&&nx<=11&&0<=ny&&ny<=11&&f[ny][nx]=='1')
							{
								f[ny][nx]='0';
								xs.push(nx); ys.push(ny);
							}
						}
					}
				}
			}
		}
		cout<<ans<<endl;
	}
  return 0;
}