// mc4b.cpp : Defines the entry point for the console application.
//
#include <iostream>
using namespace std;

int main()
{
    int k, i, foundSol = -1;
    cin >> k;
    int iterat = 0;
    for (i = 1; i <= 2*k; i = i * 2) {
        if (i - 1 == k) {
            foundSol = iterat;
        }
        iterat++;
    }
    cout << foundSol << "\n";
    for (i = 1; i <= foundSol; i++) {
        cout << i << " ";
    }
}