i;main(j){for(printf("Gray code n=%d\n",j=getchar()-48),j++;j!=i>>j-1;putchar(-~i%j?48|1&(i/j^i/j>>1)>>j-2-i%j:10),i++);}