def island(f,x,y,m):

    rf = f[:][:]

    rf[y][x] = m

    for i in [-1,1]:

        if 0 <= x+i <= 11 and rf[y][x+i] == 1:

            rf = island(rf,x+i,y,m)

        if 0 <= y+i <= 11 and rf[y+i][x] == 1:

            rf = island(rf,x,y+i,m)

    return rf



while True:

    f = []; m = 2

    for i in range(12):

        f.append(list(map(int, list(input()))))

    for y in range(12):

        for x in range(12):

            if f[y][x] == 1:

                f = island(f,x,y,m)

                m += 1

    ans = []

    for i in range(12):

        for j in range(12):

            ans.append(f[i][j])

    ans = list(set(ans))

    print(len(ans) - 1*ans.count(0))

    try:input()

    except: break
W,H = 12,12

dxy = [[1,0],[0,1],[-1,0],[0,-1]]

def solve(field,w,h):

	if 0 <= w < W and 0 <= h < H and field[h][w] == "1":

		field[h][w] = "0"

		for dx,dy in dxy:

			solve(field,w+dx,h+dy)



while 1:

	try:

		field = [list(input()) for i in range(H)]

		ans = 0

		for h in range(H):

			for w in range(W):

				if field[h][w] == "1":

					solve(field,w,h)

					ans += 1

		print(ans)

		input()

	except:

		break
def island(f, x, y, m):
    rf = f[:][:]
    rf[y][x] = m
    for i in [-1, 1]:
        if 0 <= x + i <= 11 and rf[y][x + i] == 1:
            rf = island(rf, x + i, y, m)
        if 0 <= y + i <= 11 and rf[y + i][x] == 1:
            rf = island(rf, x, y + i, m)
    return rf


while True:
    f = []
    m = 2
    for i in range(12):
        f.append(list(map(int, list(input()))))
    for y in range(12):
        for x in range(12):
            if f[y][x] == 1:
                f = island(f, x, y, m)
                m += 1
    ans = []
    for i in range(12):
        for j in range(12):
            ans.append(f[i][j])
    ans = list(set(ans))
    print(len(ans) - 1 * ans.count(0))
    try:
        input()
    except:
        break

W, H = 12, 12
dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]


def solve(field, w, h):
    if 0 <= w < W and 0 <= h < H and field[h][w] == "1":
        field[h][w] = "0"
        for dx, dy in dxy:
            solve(field, w + dx, h + dy)


while 1:
    try:
        field = [list(input()) for i in range(H)]
        ans = 0
        for h in range(H):
            for w in range(W):
                if field[h][w] == "1":
                    solve(field, w, h)
                    ans += 1
        print(ans)
        input()
    except:
        break

-def island(f, x, y, m): -    rf = f[:][:] -    rf[y][x] = m -    for i in [-1, 1]: -        if 0 <= x + i <= 11 and rf[y][x + i] == 1: -            rf = island(rf, x + i, y, m) -        if 0 <= y + i <= 11 and rf[y + i][x] == 1: -            rf = island(rf, x, y + i, m) -    return rf +W, H = 12, 12 +dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]] -while True: -    f = [] -    m = 2 -    for i in range(12): -        f.append(list(map(int, list(input())))) -    for y in range(12): -        for x in range(12): -            if f[y][x] == 1: -                f = island(f, x, y, m) -                m += 1 -    ans = [] -    for i in range(12): -        for j in range(12): -            ans.append(f[i][j]) -    ans = list(set(ans)) -    print(len(ans) - 1 * ans.count(0)) +def solve(field, w, h): +    if 0 <= w < W and 0 <= h < H and field[h][w] == "1": +        field[h][w] = "0" +        for dx, dy in dxy: +            solve(field, w + dx, h + dy) + + +while 1: +        field = [list(input()) for i in range(H)] +        ans = 0 +        for h in range(H): +            for w in range(W): +                if field[h][w] == "1": +                    solve(field, w, h) +                    ans += 1 +        print(ans)