#include <stdio.h>
#include <stdlib.h>

int InsertionSort(int *, int ,int);
int CreateG(int, int, int *);

int main()
{
	int i, j;
	int n;
	int *A;
	int m;
	int sourceOfG[100];
	int G[100];
	int count = 0;

	// input
	scanf("%d", &n);
	A = (int *)malloc(n * sizeof(int));
	for(i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}

	// shell sort
	m = CreateG(n, 0, G);
	for(i = 0; i < m; i++)
	{
		count += InsertionSort(A, n, G[i]);
	}
	
	// output
	printf("%d\n", m);
	for(i = 0; i < m - 1; i++)
	{
		printf("%d ", G[i]);
	}
	printf("%d\n%d\n", G[i], count);
	for(i = 0; i < n; i++)
	{
		printf("%d\n", A[i]);
	}
	return 0;
}

// ??????????????? g ????????¢??????????´??????????????±???¨???????????\?????????	
int InsertionSort(int A[], int n, int g)
{
	int i, j;
	int tmp;
	int count = 0;
	
	for(i = g; i < n; i++)
	{
		j = i - g;
		while(j >= 0 && A[j] > A[i])
		{
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
			j = j - g;
			count++;
		}
	}
	return count;
}	

// G[] ????????????????????¢??°
// G[0] <= n ?????? G[i] - G[i + 1] = 3 ^ (m - n)
// ex: 121, 40, 13, 4, 1  (n = 130)
// n: G ?????????  d: ?????????
// G[]:??????????????¨???????????????
// retval: G[] ???????´???° m
int CreateG(int n, int d, int G[])
{
	int i;
	static int m = 0;
	static int factorial = 1;
	
	d += factorial;
	factorial *= 3;
	
	if(d > n) return 0;
	CreateG(n, d, G);
	G[m] = d;
	m++;
	
	return m;
}