#37815: python 紀錄


BensonDC (python戰士)


n=int(input())
L=[int(x) for x in input().split()]
o=sorted([i for i in L if i%2==1],reverse=True)
e=sorted([i for i in L if i %2==0])
print(*e,*o)