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

int m[12][12];

void dfs(int r, int c) {
  m[r][c] = 2;
  if (r && m[r-1][c]==1) dfs(r-1, c);
  if (r<11 && m[r+1][c]==1) dfs(r+1, c);
  if (c && m[r][c-1]==1) dfs(r, c-1);
  if (c<11 && m[r][c+1]==1) dfs(r, c+1);
}

int main() {
  char buf[15];
  int c;

  while (1) {
    c = 0;
    for (int i=0; i<12; i++) {
      cin >> buf;
      for (int j=0; j<12; j++) {
        m[i][j] = buf[j] - '0';
      }
    }
    if (cin.eof()) break;

    for (int i=0; i<12; i++) {
      for (int j=0; j<12; j++) {
        if (m[i][j]==1) {
          dfs(i, j);
          ++c;
        }
      }
    }
    cout << c << endl;
  }

  return 0;
}