#include using namespace std; typedef long long ll; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = (1<<30)-1; const int MOD = 1e9+7; const ll LINF = (1ll<<62)-1; #define REP(i,n) for(int i=0;i<(n);++i) #define COUT(x) cout<<(x)<<"\n" #define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n"; int power3[20]; int main(){ //input int n;cin >> n; vector e(n); REP(i,n){ cin >> e[i]; } power3[0] = 1; for (int i=1;i<=n;i++) power3[i] = 3*power3[i-1]; //3-bit-search for(int bit=0;bit