n, a = gets.to_i, $stdin.read.split.map(&: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!
b = a == [2, 3] ? [3, 2] : a
puts b + w