n = gets.to_i
a = n.times.map{gets.to_i}
zero, one = a.count(0), a.count(1)
a.delete(0)
a.delete(1)
w = zero >= 2 ? [0] * zero + [1] * one : [1] * one + [0] * zero
a.sort!
if w == [0]
  b = a[1..-1] + a[0, 1]
else
  b = a == [2, 3] ? [3, 2] : a
end
puts b + w