Problem:
Score : 1000 points

Problem Statement

We will call a string x good if it satisfies the following condition:

Condition: x can be represented as a concatenation of two copies of another string y of length at least 1.

For example, aa and bubobubo are good; an empty string, a, abcabcabc and abba are not good.

Eagle and Owl created a puzzle on good strings.
Find one string s that satisfies the following conditions. It can be proved that such a string always exists under the constraints in this problem.

1 ≤ |s| ≤ 200

Each character of s is one of the 100 characters represented by the integers 1 through 100.

Among the 2^{|s|} subsequences of s, exactly N are good strings.

Constraints

1 ≤ N ≤ 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

In the first line, print |s|, the length of s.
In the second line, print the elements in s in order, with spaces in between. Any string that satisfies the above conditions will be accepted.

Sample Input 1

7

Sample Output 1

4
1 1 1 1

There are two good strings that appear as subsequences of s: (1,1) and (1,1,1,1). There are six occurrences of (1,1) and one occurrence of (1,1,1,1), for a total of seven.

Sample Input 2

299

Sample Output 2

23
32 11 11 73 45 8 11 83 83 8 45 32 32 10 100 73 32 83 45 73 32 11 10

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(), v.end()
#define fori(i, j, k) for (int i = (j); i < (int)(k); i++)
#define forb(i, j, k) for (int i = (j); i >= (int)k; i--)
#define lchild(ind) 2 * ind + 1
#define rchild(ind) 2 * ind + 2
#define bug(val) cout << "# " << val << endl;
#define bugs(val) cout << '_' << val;
#define bugl(val) cout << "## " << val << endl;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
typedef pair<ll, pll> plp;
typedef pair<pll, int> ppi;
typedef pair<pll, ll> ppl;
typedef pair<pll, pll> ppp;
typedef vector<int> vi;
typedef vector<ll> vll;

const int maxn = 1e5 + 1;
const ll inf = 2e18, mod = 1e9 + 7;

int ind = 1;

deque<int> solve(ll n)
{
	deque<int> res;
	if (!n)
		return res;
	if (n == 1)
	{
		res.pb(ind), res.pb(ind);
		ind++;
		return res;
	}
	if (n == 2)
	{
		res.pb(ind), res.pb(ind);
		ind++;
		res.pb(ind), res.pb(ind);
		ind++;
		return res;
	}
	if (n & 1)
	{
		deque<int> tmp = solve((n - 1) / 2);
		fori (i, 0, tmp.size())
		{
			if (i == (int)tmp.size() / 2)
				res.pb(ind);
			res.pb(tmp[i]);
		}
		res.pb(ind++);
		return res;
	}
	else
	{
		deque<int> tmp = solve((n - 2) / 2);
		fori (i, 0, tmp.size())
		{
			if (i == (int)tmp.size() / 2)
				res.pb(ind);
			res.pb(tmp[i]);
		}
		res.pb(ind++);
		res.pf(ind), res.pb(ind), ind++;
		return res;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	ll n;
	cin >> n;
	deque<int> ans = solve(n);
	cout << ans.size() << endl;
	for (int i : ans)
		cout << i << ' ';
	cout << endl;
}