#include <iostream>
using namespace std;

char island[12][12];
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};


void dfs(int x, int y) {
  island[x][y] = '0';
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (0 <= nx && nx < 12 && 0 <= ny && ny < 12
	&& island[nx][ny] == '1') {
      dfs(nx, ny);
    }
  }
  return;
}

void solve() {
  int res = 0;
  for (int i = 0; i < 12; i++) {
    for (int j = 0; j < 12; j++) {
      if (island[i][j] == '1') {
	dfs(i, j);
	res++;
      }
    }
  }
  cout << res << endl;
}


int main(void) {
  while (cin >> island[0][0]) {
    for (int i = 0; i < 12; i++) {
      for (int j = 0; j < 12; j++) {
	if (i == 0 && j == 0) continue;
	cin >> island[i][j];
      }
    }
    solve();
  }

  return 0;
}