#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<iostream>
using namespace std;
typedef unsigned long long ull;
int main()
{
int i,j,n;
ull f[35],a[35],g[35];
a[0]=1;
for(i=1;i<=30;i++)
{
a[i]=a[i-1]*2;
}
f[0]=f[1]=f[2]=0;
g[0]=1;g[1]=2;g[2]=4;
for(i=3;i<=30;i++)
{
f[i]=a[i-3];
for(j=2;j<=i-2;j++)
{
f[i]+=g[j-2]*a[i-j-2];
}
g[i]=a[i]-f[i];
}
while(~scanf("%d",&n)&&n)
{
cout<<f[n]<<endl;
}
return 0;
}