n = int(input())
l = list(map(int, input().split()))
e = 0
o = 0
le = []
lo = []
for i in range(n):
if l[i]%2 == 0:
e +=1
le.append(l[i])
else:
o +=1
lo.append(l[i])
le.insert(0, e)
lo.insert(0, o)
for j in range(e + 1):
print(le[j], end = " ")
print()
for s in range(o + 1):
print(lo[s], end = " ")