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)