import sys

A=list(range(12))

m=[[0 for i in A] for j in A]

def f(y,x,d):

    P=[]

    x+=d[0]

    y+=d[1]

    if 0<=x<12 and 0<=y<12 and m[y][x]==1:

        m[y][x]=c

        P=[[y,x]]

    return P

def v1(buf):

    global c

    while buf!=[]:

        y,x=buf.pop()

        m[y][x]=c

        for e in [(-1,0),(1,0),(0,-1),(0,1)]:buf+=f(y,x,e)

    c+=1

    return

def solve():

    global c

    c=2

    for i in A:

        while m[i].count(1)>0:v1([[i,m[i].index(1)]])

    print(c-2)

    return 0

y=0

for s in sys.stdin:

    if y<12:

        m[y]=list(map(int,list(s[:-1])))

        y+=1

    else:y=solve()

solve()
import sys

A=list(range(14))

m=[[0 for i in A] for j in A]

def f(y,x):

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

        m[y][x]=0

        f(y,x+1)

        f(y,x-1)

        f(y+1,x)

        f(y-1,x)

    return

def solve():

    c=2

    for i in A:

        while m[i].count(1)>0:

            f(i,m[i].index(1))

            c+=1

    print(c-2)

    return 0

y=0

for s in sys.stdin:

    if y<12:

        m[y+1]=[0]+list(map(int,list(s[:-1])))+[0]

        y+=1

    else:y=solve()

solve()
import sys

A = list(range(12))
m = [[0 for i in A] for j in A]


def f(y, x, d):
    P = []
    x += d[0]
    y += d[1]
    if 0 <= x < 12 and 0 <= y < 12 and m[y][x] == 1:
        m[y][x] = c
        P = [[y, x]]
    return P


def v1(buf):
    global c
    while buf != []:
        y, x = buf.pop()
        m[y][x] = c
        for e in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
            buf += f(y, x, e)
    c += 1
    return


def solve():
    global c
    c = 2
    for i in A:
        while m[i].count(1) > 0:
            v1([[i, m[i].index(1)]])
    print(c - 2)
    return 0


y = 0
for s in sys.stdin:
    if y < 12:
        m[y] = list(map(int, list(s[:-1])))
        y += 1
    else:
        y = solve()
solve()

import sys

A = list(range(14))
m = [[0 for i in A] for j in A]


def f(y, x):
    if m[y][x] == 1:
        m[y][x] = 0
        f(y, x + 1)
        f(y, x - 1)
        f(y + 1, x)
        f(y - 1, x)
    return


def solve():
    c = 2
    for i in A:
        while m[i].count(1) > 0:
            f(i, m[i].index(1))
            c += 1
    print(c - 2)
    return 0


y = 0
for s in sys.stdin:
    if y < 12:
        m[y + 1] = [0] + list(map(int, list(s[:-1]))) + [0]
        y += 1
    else:
        y = solve()
solve()

-A = list(range(12)) +A = list(range(14)) -def f(y, x, d): -    P = [] -    x += d[0] -    y += d[1] -    if 0 <= x < 12 and 0 <= y < 12 and m[y][x] == 1: -        m[y][x] = c -        P = [[y, x]] -    return P - - -def v1(buf): -    global c -    while buf != []: -        y, x = buf.pop() -        m[y][x] = c -        for e in [(-1, 0), (1, 0), (0, -1), (0, 1)]: -            buf += f(y, x, e) -    c += 1 +def f(y, x): +    if m[y][x] == 1: +        m[y][x] = 0 +        f(y, x + 1) +        f(y, x - 1) +        f(y + 1, x) +        f(y - 1, x) -    global c -            v1([[i, m[i].index(1)]]) +            f(i, m[i].index(1)) +            c += 1 -        m[y] = list(map(int, list(s[:-1]))) +        m[y + 1] = [0] + list(map(int, list(s[:-1]))) + [0]