#include<stdio.h>
#include<stdlib.h>
int x[200] = {0};
int half(int a) {
int count = 0;
while (a > 1)
{
if (a % 2 == 1)
a = (a * 3 + 1) / 2;
else
a /= 2;
if (a < 200)x[a] = 0;
}
return count;
}
int main() {
int n, in;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &in);
x[in] = 1;
}
for (int i = 101; i >= 0; i--) {
if (x[i])half(i);
}
int flag = 1;
for (int i = 101; i >= 0; i--) {
if (x[i]) {
if (flag) {
printf("%d", i); flag = 0;
}
else {
printf(" %d", i);
}
}
}
return 0;
}
网友评论