#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

string s[12];
int dy[] = {-1, 0, 0, 1};
int dx[] = {0, -1, 1, 0};

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> s[0]) {
    for (int i = 1; i < 12; i++) {
      cin >> s[i];
    }
    int ans = 0;
    for (int i = 0; i < 12; i++) {
      for (int j = 0; j < 12; j++) {
        if (s[i][j] == '0') continue;
        dfs(i, j);
        ans++;
      }
    }
    cout << ans << endl;
  }

  return 0;
}
