#include #include #include #include using namespace std; #define LL long long #define Bool bitset const int maxn=60; int a[maxn]; Bool to[maxn]; LL num[maxn]; LL ans; bool gcd(int a,int b) { return b==0?a!=1:gcd(b,a%b); } LL DFS(int n,Bool p) { if(n==-1) return 1; LL res=DFS(n-1,p); if(p.test(n)) return res; if((p|to[n])==p) return res*num[n]; else return res+DFS(n-1,(p|to[n]))*(num[n]-1); } int main() { int n; while(~scanf("%d",&n) && n) { for(int i=0;i