#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll k;
	cin>>k;
	vector<ll> vl;
	string s = "~abcdefghijklmnopqrstuvwxyz";
	if(k<=26)
	{
		cout<<s[k]<<endl;
		return 0;
	}
	while(k>=26)
	{
		ll yu = k%26;
		k/=26;
		if(yu == 0)
		{
			yu = 26;
			k--;
		}
		vl.pb(yu);
	}
	if(k>0)
		vl.pb(k);
	reverse(all(vl));
	FOR(i,0,vl.size())
	{
		if(vl[i]>0)cout<<s[vl[i]];
		else cout<<"z";
	}
	cout<<endl;
	return 0;
}

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

void insertionSort(vector<int> &a, int g, long &cnt)
{
	int j;
	int v;
	for (int i = g; i < a.size(); i++)
	{
		v = a[i];
		j = i - g;
		while (j >= 0 && a[j] > v)
		{
			a[j + g] = a[j];
			j = j - g;
			cnt++;
			if (cnt > (int)pow(a.size(), 1.5))
			{
				return;
			}
		}
		a[j + g] = v;
	}
}

int shellSort(vector<int> &a, vector<int> &g)
{
	long cnt = 0;
	for (int i = 0; i < g.size(); i++)
	{
		insertionSort(a, g[i], cnt);
		if (cnt > (int)pow(a.size(), 1.5))
		{
			break;
		}
	}
	return cnt;
}

int main()
{
	int n;
	long cnt = 0;
	cin >> n;
	vector<int> a(n, 0);
	vector<int> org(a);
	vector<int> g;
	for (int i = 0; i < n; i++)
	{
		cin >> org[i];
	}
	for (int m = 100; m >= 1; m--)
	{
		a = org;
		g.resize(m);
		g[m - 1] = 1;
		for (int i = 1; i < m; i++)
		{
			g[m - 1 - i] = 3 * g[m - i] + 1;
			if ((g[m - 1 - i] <= 0) || (n <= g[m - 1 - i]))
			{
				g[0] = -1;
				break;
			}
		}
		if (g[0] < 0)
		{
			continue;
		}
		else
		{
			cnt = shellSort(a, g);
			if (cnt <= pow(n, 1.5))
			{
				break;
			}
		}
	}
	cout << setprecision(10) << g.size() << endl;
	for (int i = 0; i < g.size(); i++)
	{
		cout << g[i];
		if (i == g.size() - 1)
		{
			cout << endl;
		}
		else
		{
			cout << " ";
		}
	}
	cout << cnt << endl;
	for (int i = 0; i < n; i++)
	{
		cout << a[i] << endl;
	}
}
