# マスの取り出し
def island(map)
  count = 0
  12.times do |i|
    12.times do |j|
      if map[i][j] == 1
        move(i,j,map)
        count += 1 
      end
    end    
  end
  return count
end

# 移動、何が原因で答えが合わないのか分からない、どうデバッグすればいい？
def move(i, j, map)
  map[i][j] = 0
  [[1, 0],[0, 1],[-1, 0],[0,-1]].each do |x,y|
    #puts i+x
    #puts j+y
    next if i+x < 0 || i+x >= 12 || j+y == -1 || j+y == 12
    if map[i+x][j+y] == 0
     # puts map 
     # puts "next"
      next
    end 
    # 1の時 
    move(i+x, j+y, map)
    #puts "map"
  end  
  return
end

# 入力
map = []
12.times do
  map << gets.chomp.split("").map(&:to_i)
end
#print map 
#print "\n"
puts island(map)

while gets
  map = []
  12.times do
    map << gets.chomp.split("").map(&:to_i)
  end
  puts island(map)
end



