import java.io.*;

public class Main{

	// ??¶????????¨?¨??????????????????°
	final static int HEIGHT_COUNT = 12;
	final static int WIDTH_COUNT = 12;

	public static void main(String args[]) throws IOException {
		StringBuilder sb = new StringBuilder();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader??§input??????????????????????????\???????????°
		String setValue;

		// IslandCount???????????????????????????????????????
		IslandCount ic = new IslandCount(HEIGHT_COUNT, WIDTH_COUNT);

		do {
			// 12??12??????????????????IslandCount????????????????¬???????????????\??????
			for (int i = 0; i < HEIGHT_COUNT; i++) {
				setValue = br.readLine();
				for (int j = 0; j < WIDTH_COUNT; j++) {
					ic.island[i][j] = Integer.parseInt(String.valueOf(setValue.charAt(j)));
				}
			}

			// ??¶?????????????????°?????????
			int islandCount = ic.islandCount();

			// StringBuilder?????¶?????????????????°?????\???
			sb.append(String.valueOf(islandCount) + "\n");

			// ??????????????????????????????
			br.readLine();

		} while (br.ready());// ?¬?????????????????????°false?????????

		// ????????????????????????
		sb.deleteCharAt(sb.length() - 1);
		// ???????????????
		System.out.println(new String(sb));

	}

}

// ??¶?????°?????°???????????????
class IslandCount {
	public int island[][];

	private int height;
	private int width;

	private int islandCount;

	// ??????????????????????????¨
	IslandCount(int height, int width) {
		this.island = new int[height][width];
		this.height = height;
		this.width = width;
		this.islandCount = 0;
	}

	/**
	 * ??¶???????´¢??????????????????????????¢?????????1???????????¨??????????????????????§????
	 */
	private void initialValue() {

		// for?????§??????????????¢???
		for (int i = 0; i < height; i++) {
			for (int j = 0; j < width; j++) {
				if (island[i][j] == 1) {// island[0][0]???island[0][1]????????????1????????£?????¶???????????¨???????????\
					// ??¶?????§??????????????\??????????????????
					centerExist(i, j);

					// ??¶?????°???+1????????????
					islandCount++;
				}
			}
		}

	}

	/**
	 * initialValue??????????????§??????????????´??????0??¨????????£??\????????????????????????????????\?????????
	 */
	private void centerExist(int y, int x) {

		// ??????????????¶???0?????????
		island[y][x] = 0;

		if (topExist(y, x)) {
			// true?????´??????y?????????-1?????????????????????centerExist??????????????????????????????
			centerExist(y - 1, x);
		}

		if (bottomExist(y, x)) {
			// true?????´??????y?????????+1?????????????????????centerExist??????????????????????????????
			centerExist(y + 1, x);
		}

		if (rightExist(y, x)) {
			// true?????´??????x?????????+1?????????????????????centerExist??????????????????????????????
			centerExist(y, x + 1);
		}

		if (leftExist(y, x)) {
			// true?????´??????x?????????-1?????????????????????centerExist??????????????????????????????
			centerExist(y, x - 1);
		}
	}

	/**
	 * ????????????1????????¨????????´??????0????¨???????true????????????????????\??????false????????????
	 */
	private boolean topExist(int topY, int topX) {
		boolean ret = false;
		// y??????0??\?????§????????°???????????????
		if (topY - 1 >= 0) {
			// ??????????????§?¨??????????1??§????????´??????true????????????????????§?¨????0?????\??????
			if (island[topY - 1][topX] == 1) {
				island[topY - 1][topX] = 0;
				ret = true;
			}
		}
		return ret;
	}

	/**
	 * ????????????1????????¨????????´??????0????¨???????true????????????????????\??????false????????????
	 */
	private boolean rightExist(int rightY, int rightX) {
		boolean ret = false;
		// x??????width??\?????§????????°???????????????
		if (rightX + 1 < width) {
			// ??????????????§?¨??????????1??§????????´??????true????????????????????§?¨????0?????\??????
			if (island[rightY][rightX + 1] == 1) {
				island[rightY][rightX + 1] = 0;
				ret = true;
			}
		}
		return ret;

	}

	/**
	 * ????????????1????????¨????????´??????0????¨???????true????????????????????\??????false????????????
	 */
	private boolean bottomExist(int bottomY, int bottomX) {
		boolean ret = false;

		// y??????height??\?????§????????°???????????????
		if (bottomY + 1 < height) {
			// ??????????????§?¨??????????1??§????????´??????true????????????????????§?¨????0?????\??????
			if (island[bottomY + 1][bottomX] == 1) {
				island[bottomY + 1][bottomX] = 0;
				ret = true;
			}
		}
		return ret;

	}

	/**
	 * ????????????1????????¨????????´??????0????¨???????true????????????????????\??????false????????????
	 */
	private boolean leftExist(int leftY, int leftX) {
		boolean ret = false;
		// y??????0??\?????§????????°???????????????
		if (leftX - 1 >= 0) {
			// ??????????????§?¨??????????1??§????????´??????true????????????????????§?¨????0?????\??????
			if (island[leftY][leftX - 1] == 1) {
				island[leftY][leftX - 1] = 0;
				ret = true;
			}
		}
		return ret;

	}

	/**
	 * ??¶?????°?????????
	 * 
	 * @return islandSetCount
	 */
	public int islandCount() {
		initialValue();
		
		int islandSetCount = islandCount;
		islandCount = 0;
		return islandSetCount;

	}

}

Measured memory_bytes: 24764