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

bool MAP[12][12];
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

void sink_one_island(int x, int y) {
  if (x < 0 or 11 < x or y < 0 or 11 < y or !MAP[x][y])
    return;

  MAP[x][y] = false;
  for (int i = 0; i < 4; i++)
    sink_one_island(x + dx[i], y + dy[i]);
}

int sink_all_islands() {
  int islands = 0;

  for (int x = 0; x < 12; x++) {
    for (int y = 0; y < 12; y++) {
      if (MAP[x][y]) {
        sink_one_island(x, y);
        islands++;
      }
    }
  }

  return islands;
}

int main() {
  string s;
  while (cin >> s) {
    if (s.empty()) continue;

    for (int x = 0; x < 12; x++)
      MAP[x][0] = (s[x] == '1')? true:false;

    for (int y = 1; y < 12; y++) {
      cin >> s;
      for (int x = 0; x < 12; x++)
        MAP[x][y] = (s[x] == '1')? true:false;
    }

    int ids = sink_all_islands();

    cout << ids << endl;
  }
}