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

const int H = 12;
const int W = H;
const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};
char G[H][W];

void dfs(int i, int j) {
  G[i][j] = '0';
  for(int k = 0; k < 4; ++k) {
    int ni = i + di[k];
    int nj = j + dj[k];
    if(ni < 0 || ni >= H) continue;
    if(nj < 0 || nj >= W) continue;
    if(G[ni][nj] != '1') continue;
    dfs(ni,nj);
  }
}

int main() {
  while(1) {
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        if(cin >> G[i][j]) ; else return 0;
      }
    }

    int ans = 0;
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        if(G[i][j] == '1') {
          ++ans;
          dfs(i, j);
        }
      }
    }
    cout << ans << endl;

  }
  return 0;
}