#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


int cnt = 0;

void insertionsort(int a[], int n, int g){
	for (int i = g; i < n; i++){
		int v = a[i];
		int j = i - g;
		while (j >= 0 && a[j] > v){
			a[j + g] = a[j];
			j -= g;
			cnt++;
		}
		a[j + g] = v;
	}
}

signed main(){

	int n;
	int a[1000000];
	int g[100];

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	g[0] = 1;
	int m;
	for (m = 0; g[m] <= n; m++){
		g[m + 1] = g[m] * 3 + 1;
	}

	for (int i = m-1; i >= 0; i--)
		insertionsort(a, n, g[i]);

	cout << m << endl;
	for (int i = m-1; i >= 0; i--)
		cout << g[i] << " ";
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < n; i++)
		cout << a[i] << endl;

	return 0;
}

