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

int InsertionSort(int *, int ,int);

int main()
{
	int i;
	int n;
	int *A;
	int m;
	int *G;
	int count = 0;
	
	// input
	scanf("%d", &n);
	A = (int *)malloc(n * sizeof(int));
	for(i = 0; i < n; i++)
	{
		scanf("%d", &A[i]);
	}
	m = n;
	G = (int *)malloc(m * sizeof(int));
	for(i = 0; i < m; i++)
	{
		G[i] = i;
	}
	
	// shell sort
	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;
}
	
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;
}
		