#include <iostream>
#include <vector>
using namespace std;
int main() {
int n = 0;
cin >> n;
//[2,2,1,1,1]->[2,2,2,1]->[4,2,1]
vector<int> nums;
for (int i = 0; i < n; ++i) {
int num = 0;
cin >> num;
nums.push_back(num);
}
int hash[10001] = { 0 };
for (int i = 0; i < nums.size(); ++i) {
hash[nums[i]]++;
}
for (int i = 0; i < 10001; ++i) {
int sum = 0;
if (hash[i] % 2 == 1) {
int num = hash[i] - 1;
sum = num * i;
hash[sum] += 1;
hash[i] = 1;
}
else if (hash[i] % 2 == 0) {
int num = hash[i];
sum = num * i;
hash[sum] += 1;
hash[i] = 0;
}
}
for (int i = 0; i < 10001; ++i) {
if (hash[i] == 1) {
cout << i << " ";
}
}
return 0;
}