#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <limits>
#include <algorithm>
#include <queue>
#include <set>
#include <unordered_map>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <stack>
#include <string>
#include <functional>
using namespace std;

using i64 = long long int;
using ui64 = unsigned long long int;

using P = pair<int, int>;

constexpr int INF = (1 << 30);
constexpr i64 INF64 = (1LL << 60);
constexpr int MOD = 1000000000 + 7;

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

template <typename T, typename U>
static inline std::vector<U> makeNdVector(T n, U val) noexcept {
   static_assert(std::is_integral<T>::value, "[makeNdVector] 1st argument must be an integer type");
   return std::vector<U>(std::forward<T>(n), std::forward<U>(val));
}

template <typename T, typename ...Args>
static inline decltype(auto) makeNdVector(T n, Args... args) noexcept {
   static_assert(std::is_integral<T>::value, "[makeNdVector] 1st argument must be an integer type");
   return std::vector<decltype(makeNdVector(std::forward<Args>(args)...))>(std::forward<T>(n), makeNdVector(std::forward<Args>(args)...));
}

template <typename T>
void print(vector<T> vec)
{
   for (auto &e : vec)
      cout << e << " ";
   cout << endl;
}

template <typename T>
T gcd(T x, T y) {
   if (x == 0 || y == 0) return 0;
   T r;
   while ((r = x % y) != 0) {
      x = y;
      y = r;
   }
   return y;
}

template <typename T>
T lcm(T x, T y) {
   if (x == 0 || y == 0) return 0;
   return (x / gcd(x, y) * y);
}

int next_combination(int sub)
{
   int x = sub & -sub, y = sub + x;
   return (((sub & ~y) / x) >> 1) | y;
}

std::uint64_t combination(int n, int r) {
   if (n < 0 || r < 0) return 0;
   if (n < r) return 0;
   std::uint64_t k = 1;
   for (std::uint64_t d = 1; d <= r; ++d) {
      k *= n--;
      k /= d;
   }
   return k;
}

bool check(string str) {
	for (int i = 0; i < str.length() / 2; ++i) {
		if (str[i] != str[str.length() - 1 - i]) {
			return false;
		}
	}
	return true;
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	using P = pair<i64, i64>;

	vector<string> G(12);

	while (cin >> G[0]) {
		for (int i = 1; i < 12; ++i) cin >> G[i];

		map<P, int> used;
		int ans = 0;
		for (int i = 0; i < 12; ++i) {
			for (int j = 0; j < 12; ++j) {
				if (used[P(i, j)]) continue;
				if (G[i][j] == '0') continue;
				ans++;
				stack<P> S;
				S.emplace(i, j);
				while (!S.empty()) {
					int y, x;
					tie(y, x) = S.top();
					S.pop();
					for (int k = 0; k < 4; ++k) {
						int ny = y + dy[k], nx = x + dx[k];
						if (ny < 0 || ny >= 12 || nx < 0 || nx >= 12 || G[ny][nx] == '0') continue;
						if (used[P(ny, nx)]) continue;
						used[P(ny, nx)] = 1;
						S.emplace(ny, nx);
					}
				}
			}
		}
		cout << ans << endl;
	}
}
