def identification(x,y,arr)
    if(arr[y][x]==1)
        arr[y][x]=0
        identification(x-1,y,arr) if x-1>=0 && arr[y][x-1]==1
        identification(x+1,y,arr) if x+1<12 && arr[y][x+1]==1
        identification(x,y-1,arr) if y-1>=0 && arr[y-1][x]==1
        identification(x,y+1,arr) if y+1<12 && arr[y+1][x]==1
        return true
    end
    return false
end
while !STDIN.eof?
    arr=[]
    count=0
    12.times do
        arr<<gets.split(//).map(&:to_i)
    end
    gets
    12.times do |y|
        12.times do |x|
            count+=1 if identification(x,y,arr)
        end
    end
    p count
end