#include <cstdio>

using namespace std;

char m[16][16], *nl;

void rec(int x, int y) {
  if (x < 0 || x >= 12 || y < 0 || y >= 12 || m[x][y] == '0')
    return;
  m[x][y] = '0';
  rec(x+1, y);
  rec(x-1, y);
  rec(x, y+1);
  rec(x, y-1);
}

int main() {
  while (fgets(m[0], 16, stdin)) {
    for (int i = 1; i < 13; i++)
      fgets(m[i], 16, stdin);
    int c = 0;
    for (int x = 0; x < 12; x++)
      for (int y = 0; y < 12; y++)
        if (m[x][y] == '1') {
          rec(x, y);
          c++;
        }
    printf("%d\n", c);
  } while (nl);
  return 0;
}