//poj 1737 该题可用于求指定顶点数的无向连通图个数
//膜拜这位仁兄的解题报告:http://hi.baidu.com/accplaystation/blog/item/51417bdca982bea4cc116660.html
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf=1<<28;
int n;
int temp[500];
struct node
{
int a[500];
node(){}
void set(int b)
{
memset(a,0,sizeof(a));
do{
a[++a[0]]=b%10;
b/=10;
}while (b);
}
void set(const int b[])
{
memset(a,0,sizeof(a));
for (int i=0;i<=b[0];i++) a[i]=b[i];
}
void clear() { memset(a,0,sizeof(a)); }
void add (const int b[])
{
if (a[0]<b[0]) a[0]=b[0];
for (int i=1;i<=a[0];i++)
{
a[i]+=b[i];
if (a[i]>9)
{
a[i+1]+=a[i]/10;
a[i]%=10;
}
}
while (a[a[0]+1]) ++a[0];
}
void mul(const int b)
{
for (int i=1;i<=a[0];i++) a[i]*=b;
for (int i=1;i<=a[0];i++)
if (a[i]>9)
{
a[i+1]+=a[i]/10;
a[i]%=10;
}
while (a[a[0]+1]) ++a[0];
}
void mul (const int b[])
{
memset(temp,0,sizeof(temp));
for (int i=1;i<=a[0];i++)
for (int j=1;j<=b[0];j++)
{
temp[i+j-1]+=a[i]*b[j];
temp[i+j]+=temp[i+j-1]/10;
temp[i+j-1]%=10;
}
for (temp[0]=a[0]+b[0]+1;temp[0]>1 && !temp[temp[0]]; --temp[0]);
memset(a,0,sizeof(a));
for (int i=0;i<=temp[0];i++) a[i]=temp[i];
}
void print()
{
for (int i=a[0];i>=1;i--) printf("%d",a[i]);
printf("/n");
}
}dp[51],mi[51],tmp,c[51][51];
void minus1(int a[])
{
a[1]--;
for (int i=1;i<=a[0];i++)
if (a[i]<0)
{
a[i]=9;
a[i+1]--;
}
else break;
if (!a[a[0]]) --a[0];
}
int main()
{
mi[0].set(1);
for (int i=1;i<=50;i++)
{
mi[i].set(mi[i-1].a);
mi[i].mul(2);
}
for (int i=0;i<=50;i++) minus1(mi[i].a);
//for (int i=0;i<=50;i++) mi[i].print();
for (int i=0;i<=50;i++) c[i][0].set(1);
for (int i=1;i<=50;i++)
for (int j=1;j<=i;j++)
{
c[i][j].set(c[i-1][j-1].a);
c[i][j].add(c[i-1][j].a);
}
dp[1].set(1);
dp[2].set(1);
for (int i=3;i<=50;i++)
for (int k=1;k<i;k++)
{
tmp.set(dp[k].a);
tmp.mul(dp[i-k].a);
tmp.mul(c[i-2][k-1].a);
tmp.mul(mi[k].a);
dp[i].add(tmp.a);
}
// for (int i=1;i<=50;i++)
// dp[i].print(),printf("/n");
while (scanf("%d",&n) && n) dp[n].print();
//system("pause");
return 0;
}