n = int(input())
nums = list(map(int, input().split()))
left, i, right = -1, 0, n
while i < right:
    if nums[i] == 1:
        i += 1
        continue
    if nums[i] == 2:
        right -= 1
        nums[i], nums[right] = nums[right], nums[i]
    else:
        left += 1
        nums[i], nums[left] = nums[left], nums[i]
        i += 1
print(*nums)