#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

vector<VB> a(12, VB(12));
vector<VB> visited(12, VB(12));
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 };

void dfs(int x, int y) {
	if (x < 0 || y < 0 || x >= 12 || y >= 12 || !a[y][x] || visited[y][x])return;
	visited[y][x] = true;
	rep(i, 4)dfs(x + dx[i], y + dy[i]);
}

int main() {
	string t;
	while (cin >> t) {
		rep(i, 12)rep(j, 12)a[i][j] = false;
		rep(i, 12)rep(j, 12)visited[i][j] = false;
		VS s(12); s[0] = t;
		rep(i, 11)cin >> s[i + 1];
		rep(i, 12)rep(j, 12) {
			if (s[i][j] == '1')a[i][j] = true;
			else a[i][j] = false;
		}

		int ans = 0;
		rep(i, 12) {
			rep(j, 12) {
				if (a[i][j] && !visited[i][j]) { ans++; dfs(j, i); }
			}
		}
		Cout(ans);
	}
}
