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)

if zero % 2 == 1 && one >= 1
  w = [0] * (zero - 1) + [1] + [0] + [1] * (one - 1)
  zero_f = false
else
  w = [0] * zero + [1] * one
  zero_f = true
end

a.sort!
if zero_f
  b = a[1..-1] + a[0, 1]
else
  b = a == [2, 3] ? [3, 2] : a
end
puts b + w