#include <stdio.h>

int cnt,m;
int G[100];
void printfa(int G[],int m){
	int i;
	for(i=m-1;i>-1;i--){
		if(i<m-1){
			printf(" ");
		}
		printf("%d",G[i]);
		if(i==0){
			printf("\n");
		}
	}
}
void insertionSort(int A[], int n,int g){
	int i,j,v;
	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;
	}
}

void shellSort(int A[],int n){
	int i;
	int h=1;
	for(i=0;i<n;i++){
		if(h>n){
			break;
		}
		G[i]=h;
		h=3*h+1;
		m++;
	}
	for(i=m;i>=0;i--){
		insertionSort(A, n, G[i]);
	}
}
int main(void){
	int A[1000000];
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf(" %d",&A[i]);
	}
	shellSort(A,n);
	printf("%d\n",m);
	printfa(G,m);
	printf("%d\n",cnt);
	for(i=0;i<n;i++){
		printf("%d\n",A[i]);
	}
	return 0;
}
