#include<iostream>using namespace std;int main(){int a[22]={0,1};int i,n;for(i=2;i<=20;i++) a[i]=3*a[i-1]+1;scanf("%d",&n);while(n--){ scanf("%d",&i); printf("%d\n",2*a[i-1]+2);}return 0;}