import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		// ?????????????????????(??????????????????)
		PackMan packman = new PackMan();

		// ?????????????????¨?¨????????????°?????¨???
		final int VERTICALLIMIT = 12;
		final int SIDELIMIT = 12;

		Scanner in = new Scanner(System.in);
		// ????????°??????????´?????????????
		String[][] worldMap = new String[VERTICALLIMIT][SIDELIMIT];
		// ???????????????????£?????????¶?????°???????´????????????????
		ArrayList<Integer> packmanCount = new ArrayList<>();
		// ?£?????????¶?????°????????????????????????????????°;
		int count = 0;

		while (in.hasNext()) {

			// ????????????????????????????????§??????????????????
			for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) {

				// ??????????§?????????\???
				String world = in.next();

					// ??????????§??????????????????°????????????
					worldMap[verticalNum] = world.split("");

				
			}

			// ????????????????????????????????§??????????????????
			for (int verticalNum = 0; verticalNum < VERTICALLIMIT; verticalNum++) {

				// ?¨??????????????????????????????§??????????????????
				for (int sideNum = 0; sideNum < SIDELIMIT; sideNum++) {

					// ??¶??????????????????
					if (worldMap[verticalNum][sideNum].equals("1")) {

						// ????????????????????¶????£?????°???????
						packman.eatIsland(worldMap, verticalNum, sideNum);

						// ??????????????£?????¶?????°??????(???????????\?????????)
						count++;

					}
				}
			}

			// ???????????????????£???????????????¶?????°?????????
			packmanCount.add(count);
			// ?¬???????????????????????????????????????¨??????????????????
			count = 0;

		}

		// ????????????????????????????????£?????¶???????¨??????????
		for(int result: packmanCount) {

			System.out.println(result);

		}
	}
}

// ????????????????????????????????¨????????????????????????????????§????????¨??????????????????????????????????????±??§????????????
class PackMan{

	// ?????????????????????????????°?????¨???
	final int VERTICALZERO = 0;
	final int VERTICALLIMIT = 11;
	final int SIDEZERO = 0;
	final int SIDELIMIT = 11;

	void eatIsland(String[][] worldMap, int verticalNum, int sideNum) {

		// ????????????????????¶????±????????????¨???
		if (worldMap[verticalNum][sideNum].equals("1")) {

			// ??¶???????????????????£?????§???????
			worldMap[verticalNum][sideNum] = "0";

			// ???????????????????????????????????????????????????????°?????????????
			if (verticalNum > VERTICALZERO) {

				// ?????????????£???????
				eatIsland(worldMap, verticalNum - 1, sideNum);

			}

			// ???????????????????????????????????????????????????????°?????????????
			if (verticalNum < VERTICALLIMIT) {

				// ???????????§?£???????
				eatIsland(worldMap, verticalNum + 1, sideNum);

			}

			// ???????????????????????????????????????????????????????°?????????????
			if (sideNum > SIDEZERO) {

				// ???????????§????£???????
				eatIsland(worldMap, verticalNum, sideNum - 1);

			}

			// ???????????????????????????????????????????????????????°?????????????
			if (sideNum < SIDELIMIT) {

				// ??¨?????§????????¶???
				eatIsland(worldMap, verticalNum, sideNum + 1);

			}
		}
	}
}


// ==============================?????°???????????????=======================================

  /*if(worldMap[i + 1][j] == 0 && worldMap[i - 1][j] == 0 && worldMap[i][j + 1] == 0 && worldMap[i][j - 1] == 0) {

	  worldMap[i][j] = 0;

  } else if(worldMap[i + 1][j] == 1 || worldMap[i - 1][j] != 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){

	  packman(worldMap, i + 1, j);

  } else if(worldMap[j + 1][j] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0) {

	  packman(worldMap, i, j + 1);

  } else if(worldMap[i][j - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i - 1][j] != 0 || worldMap[i][j - 1] != 0){

	  packman(worldMap, i, j - 1);

  } else if(worldMap[i][i - 1] == 1 && worldMap[i + 1][j] == 0 || worldMap[i][j + 1] != 0 || worldMap[i][j - 1] != 0){

	  packman(worldMap, i - 1, j);

  }

  	worldMap[i][j] = 0;*/

Measured memory_bytes: 26460