#include <iostream>
#include <vector>
using namespace std;

int d[4] = {-1,0,1,0};

void func(char (*imap)[12], int x, int y){
  imap[x][y] = '0';
  for(int i=0; i<4; ++i){
    for(int j=0; j<4; ++j){
      int dx = d[i], dy = d[j];
      int nx = x + dx, ny = y + dy;
      if(nx < 0 || 12 <= nx) continue;
      if(ny < 0 || 12 <= ny) continue;
      if(imap[nx][ny] == '0') continue;
      else func(imap,nx,ny);
    }
  }
}

int main(void){
  char island_map[12][12];
  int res=0;
  while(1){
    for(int i=0; i<12; ++i){
      for(int j=0; j<12; ++j){
	if(cin >> island_map[i][j]);
	else return 0;
      }
    }
    for(int i=0; i<12; ++i){
      for(int j=0; j<12; ++j){
	if(island_map[i][j]=='1'){
	  res++;
	  func(island_map,i,j);
	  }
      }
    }
    cout << res << endl;
    res = 0;
  }
}