#include #include #include using namespace std; int ap[5010]; queue q; int main () { int k; scanf ("%d", &k); printf ("%d\n", k); q.push (4095); ap[4095] = 1; for (; k; --k) { int x = q.front (); printf ("%d ", x); q.pop (); for (int i = 0; i < 12; ++i) if (((1 << i) & x) && !ap[(1 << i) ^ x]) q.push ((1 << i) ^ x), ap[(1 << i) ^ x] = 1; } printf ("\n"); return 0; }