#include <bits/stdc++.h>

using namespace std;

vector<int> A;
vector<int> G;
int cnt;

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

void shellSort(int n)
{
	for(int i = 1; i <= n; G.push_back(i), i=3*i+1);
	
	for(int i = G.size()-1; i >= 0; insertionSort(n, G[i]), i--);
}

int main()
{
	int n, x;
	
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++)
	{
		scanf("%d", &x);
		A.push_back(x);		
	}
	
	cnt = 0;
	shellSort(n);
	
	printf("%d\n", G.size());
	
	for(int i = G.size()-1; i >= 0; i--)
		printf("%d%c", G[i], i == 0 ? '\n' : ' ');
	
	printf("%d\n", cnt);
	
	for(int i = 0; i < n; i++)
		printf("%d\n", A[i]);
	
	return 0;
}
