def land(mapdata)
  count = 0
  mapdata.each_with_index{|item, idx|
    item.each_with_index{|item2, idx2|
      if item2 == 1
        mark(mapdata, idx, idx2)
        count += 1
      end
    }
  }
  return count
end
def mark(mapdata, x, y)
  if x.between?(0, 11) and y.between?(0,11) and mapdata[x][y] == 1
    mapdata[x][y] = 2
    mark(mapdata, x + 1, y)
    mark(mapdata, x - 1, y)
    mark(mapdata, x, y + 1)
    mark(mapdata, x, y - 1)
  end
end
mapdata = []
12.times do
  mapdata << gets.split(//).map(&:to_i)
end
puts land(mapdata)
while gets
  mapdata = []
  12.times do
    mapdata << gets.split(//).map(&:to_i)
  end
  puts land(mapdata)
end