#include<cstdio>
#include<algorithm>
using namespace std;
bool HashTable[100000]={false};//3n+1 会产生超过100的数
int arr[110]={0};
int main(){
int n,i=0;
scanf("%d",&n);
while(n--){
int temp;
scanf("%d",&temp);
arr[i++]=temp;
while(temp!=1){
if(temp%2==0){
temp/=2;
}else{
temp=(3*temp+1)/2;
}
HashTable[temp]=true;
}
}
int flag=0;
sort(arr,arr+i);
for(i=i-1;i>=0;i--){
if(HashTable[arr[i]]) continue;
if(!flag){
printf("%d",arr[i]);
flag=1;
}else{
printf(" %d",arr[i]);
}
}
}```