p=int(input());soni=list(map(int,input().split())) fuh=[x for x in soni if x<0];aki=[x for x in soni if x>=0] while(aki or fuh): if fuh:print(fuh[0],end=" ");fuh=fuh[1:] if aki:print(aki[0],end=" ");aki=aki[1:]