#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cmath>
using namespace std;
#define N 1005
int a[N];
int b[N];
int cnt = 0;
int n;
int main() {
cin >> n;
int s = 0;
for (int i = 0; i < n; i++) {
cnt = 0;
cin >> a[i];
int x = a[i];
while (x) {
b[cnt] += x % 3;
b[cnt] %= 3;
cnt++;
x /= 3;
}
}
int d = 1;
for (int i = 0; i < 20; i++) {
s += b[i] * d;
d *= 3;
}
printf("%d
", s);
return 0;
}
与两次的类似,两次的直接对每个数异或就行了,本质也是消掉2次重复的,3次换成3进制,每一位*3%3肯定等于0,所以影响为0 就只剩下 出现一次的数字了