//HOME- Volume0-0067

#include <iostream>
#include <string>

#define N 12

using namespace std;

int paint(int world[N][N], int h, int w);

int main() {
  while (1){
    int world[N][N];
    int ans = 0;
    string str;
    int i, j;

    for(i = 0; i < N; i++) {
      if(!(cin >> str)) return 0;
      for(j = 0; j < N; j++)
	world[i][j] = (int)(str.at(j) - '0');
    }
    
    for(i = 0; i < N; i++)
      for(j = 0; j < N; j++)
	ans += paint(world, i, j);
    
    cout << ans << endl;
  }
}

int paint(int world[N][N], int h, int w) {
  if(world[h][w] == 0)
    return 0;
  else {
    world[h][w] = 0;
    if(h + 1 < N) paint(world, h + 1, w);
    if(h - 1 >= 0) paint(world, h - 1, w);
    if(w + 1 < N) paint(world, h, w + 1);
    if(w - 1 >= 0) paint(world, h, w - 1);
    return 1;
  }
}
