#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

void solve(){
	
  vector<string> v(12);
  while(cin >> v[0]){
	  for(int i = 1; i < 12; i++) cin >> v[i];
	  bool visited[12][12];
	  for(int i = 0; i < 12; i++){
		for(int j = 0; j < 12; j++){
			 visited[i][j] = false;
		   }  
		}
	   int ret = 0;
	   for(int i = 0; i < 12; i++){
		for(int j = 0; j < 12; j++){
			 if(v[i][j] == '1' && !visited[i][j]){
				 ret++;
				 queue< pair<int, int> > q;
				 q.push(make_pair(i, j));
				 while(!q.empty()){
				  auto p = q.front();
				  q.pop();
				  int nx = p.first, ny = p.second;
				  for(int i = 0; i < 4; i++){
					  int x = nx + dx[i];
					  int y = ny + dy[i];
					  if( x >= 0 && y >= 0 && x < 12 && y < 12){
						  if (v[x][y] == '1' && !visited[x][y]){
							  visited[x][y] = true;
							  q.push(make_pair(x, y));  
							}  
						}  
					}	 
				}
		   }   
		}
	}
  cout << ret << endl;		
 }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}

