#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

string m[12];

void dfs(int y, int x) {
  m[y][x] = '0';

  rep(i,0,4) {
    if (0 > y+dy[i] && y+dy[i] >= 12 && 0 > x+dx[i] && x+dx[i] >= 12) continue;
    if (m[y+dy[i]][x+dx[i]] == '1') {
      dfs(y + dy[i], x + dx[i]);
    }
  }

}

int main() {


  while(cin>>m[0]) {
    rep(i,1,12) {
      cin >> m[i];
    }

    int ans = 0;
    rep(i,0,12) {
      rep(j,0,12) {
        if (m[i][j] == '1') {
          ans++;
          dfs(i, j);
        }
      }
    }

    cout << ans << endl;
  }

	return 0;
}