#include<iostream>
#include<vector>

using namespace std;
vector <vector<int> > randb (vector <vector<int> >island,int si,int sj,int w,int h,int num);
int main(){
  int w = 12;
  int h = 12;
  int cnt;
  char tmp;
  for(int c = 0 ; c < 20 ; c++){
    cnt = 2;
    vector <vector<int> > island(12,vector<int>(12,0));
    for(int i = 0 ; i < h ; i++){
      for(int j = 0 ; j < w ; j++){
        cin >> tmp;
        island[i][j] = (int)(tmp- '0');
      }
    }

    if(cin.good() != true){
      break;
    }

    for(int i = 0 ; i < h ; i++){
      for(int j = 0 ; j < w ; j++){
        if(island[i][j] == 1){
          island = randb(island,i,j,w,h,cnt);
          cnt++;
        }
      }
    }
    cout << cnt-2 << endl;
  }
  return 0;
}

 vector <vector<int> > randb (vector <vector<int> >island,int si,int sj,int w,int h,int num){
   if( si+1 < h  && island[si+1][sj] == 1){
     island[si+1][sj] = num;
     island = randb(island,si+1,sj,w,h,num);
   }
   if( si-1 >= 0 && island[si-1][sj] == 1){
     island[si-1][sj] = num;
     island= randb(island,si-1,sj,w,h,num);
   }
   if( sj+1 < w  && island[si][sj+1] == 1){
     island[si][sj+1] = num;
     island = randb(island,si,sj+1,w,h,num);
   }
   if( sj-1 >= 0 && island[si][sj-1] == 1){
     island[si][sj-1] = num;
     island = randb(island,si,sj-1,w,h,num);
   }
   return island;
}
