#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

void solve(vector<vector<int>> f) {
  int r = 0;
  rep (i, 12) {
    rep (j, 12) {
      if (f[i][j] == 0) continue;
      ++r;
      queue<pair<int, int>> q;
      q.push({i,j});
      while (not q.empty()) {
        auto p = q.front(); q.pop();
        if (f[p.first][p.second] == 0) continue;
        f[p.first][p.second] = 0;
        rep (k, 4) {
          int i2 = p.first + dx[k],
              j2 = p.second + dy[k];
          if (i2 < 0 or j2 < 0 or i2 >= 12 or j2 >= 12) continue;
          if (f[i2][j2] == 0) continue;
          q.push({i2, j2});
        }
      }
    }
  }
  cout << r << endl;
}

int main() {
  string s;
  while (cin) {
    vector<vector<int>> f(12, vector<int>(12));
    rep (i, 12) {
      getline(cin, s);
      rep (j, 12) {
        f[i][j] = s[j] == '1';
      }
    }
    solve(f);
    getline(cin, s);
  }
  return 0;
}