#include <iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<string>
#include<cstring>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> numbers;
    int powerOfTwo = 1;
    while(powerOfTwo < n){
        numbers.push_back(powerOfTwo);
        powerOfTwo = powerOfTwo*2;
    }

    int sz = numbers.size();
    cout << sz << endl;
    for(int i = 0; i < sz - 1; i++){
        cout << numbers[i] << " ";
    }
    cout << numbers[ sz - 1] << endl;
    //cout << "Hello world!" << endl;
    return 0;
}