#include <iostream>
#include <cstdio>

#define N 12

using namespace std;

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

char island[N][N+2];

void dfs(int y, int x)
{
  island[y][x] = '0';

  for(int i = 0; i < 4; ++i){
    int next_x = x + xdir[i];
    int next_y = y + ydir[i];

    if(0 <= next_x && next_x < N &&
       0 <= next_y && next_y < N &&
       island[next_y][next_x] == '1'){
      dfs(next_y, next_x);
    }
  }
}

int main()
{
  do {
    for(int i = 0; i < N; ++i)
      fgets(island[i], sizeof island[i]/ sizeof island[i][0], stdin);

    int count = 0;
    for(int i = 0; i < N; ++i)
      for(int j = 0; j < N; ++j)
	if(island[i][j] == '1'){
	  ++count;
	  dfs(i, j);
	}

    cout << count << endl;

  } while(fgets(island[0], sizeof island[0]/sizeof island[0][0], stdin) != NULL);

  return 0;
}