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

/* ????????????????????£?¨? */
int insertionSort(int* A, int n, int g);
int shellSort(int* A, int n);

/* main??¢??° */
int main(void){
	int* A = NULL;
	int n, cnt, i;

	scanf("%d", &n);
	A = (int*)malloc(sizeof(int)*n);
	if(A == NULL)exit(1);

	for(i = 0;i < n;i++)
		scanf("%d", &A[i]);

	cnt = shellSort(A, n);
	if(cnt == -1){
		free(A);
		exit(1);
	}
	printf("%d\n", cnt);

	for(i = 0;i < n;i++)
		printf("%d\n", A[i]);

	free(A);

	return 0;
}

/* g????????¢??????????´?????£???§??????????????°??????????????§?????\????????????????????¢??° */
int insertionSort(int* A, int n, int g){
	int cnt = 0, v, i, j;

	for(i = g;i < n;i++){
		v = A[i];
		j = i - g;
		while(j >= 0 && A[j] > v){
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}

	return cnt;
}

/* ?????§?????????????????????????????¢??° */
int shellSort(int* A, int n){
	int *G = NULL;
	int cnt = 0, m, Gm = 1, i;

	for(m = 0;Gm <= n;m++)
		Gm = 3*Gm + 1;
	printf("%d\n", m);

	G = (int*)malloc(sizeof(int)*m);
	if(G == NULL)return -1;

	G[m-1] = 1;
	for(i = m - 2;i >= 0;i--)
		G[i] = 3*G[i+1] + 1;

	printf("%d", G[0]);
	for(i = 1;i < m;i++)
		printf(" %d", G[i]);
	printf("\n");

	for(i = 0;i < m;i++)
		cnt += insertionSort(A, n, G[i]);

	free(G);

	return cnt;
}