#include <iostream>
#include <vector>
#include <string>
#include <queue>
using namespace std;
const int MAX = 12;
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
void bfs(vector<string> &field,int x,int y){
  queue<pair<int,int> > que;
  que.push(pair<int,int>(x,y));
  while(!que.empty()){
    int cx,cy;
    pair<int,int> tmp = que.front();que.pop();
    cx = tmp.first;
    cy = tmp.second;
    field[cx][cy] = '0';
    for(int i = 0;i < 4;i++){
      int nx,ny;
      nx = dx[i]+cx;ny = dy[i]+cy;
      if(nx >= 0 && nx < MAX && ny >= 0 && ny < MAX && field[nx][ny] == '1'){
	que.push(pair<int,int>(nx,ny));
      }
    }
  }
}
int main(){
  string tmp;
  while(cin >> tmp){
    vector<string> field(MAX);
    field[0] = tmp;
    for(int i = 1;i < MAX;i++){
      cin >> tmp;
      field[i] = tmp;
    }    

    int ans = 0;
    for(int i = 0;i < MAX;i++){
      for(int j = 0;j < MAX;j++){
	if(field[i][j] == '1'){
	  ans++;
	  bfs(field,i,j);
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}