#include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> #define ll long long using namespace std; ll f[40]; ll g[40]; ll qpow(ll a,ll b){ ll ans=1; while(b){ if (b&1==1)ans=ans*a; a*=a; b/=2; } return ans; } void init(){ f[0]=f[1]=f[2]=0; g[0]=1;g[1]=2;g[2]=4; for (int i=3;i<=30;i++){ ll sum=0; for(int j=2;j<=i-2;j++){ sum=sum+g[j-2]*qpow(2,i-j-2); } f[i]=qpow(2,i-3)+sum; g[i]=qpow(2,i)-f[i]; } } int main(){ init(); int n; while(~scanf("%d",&n)&&n){ printf("%lld ",f[n]); } return 0; }