#include<stdio.h>

int cnt;
void InsertionSort(int* a, int n, int g){
	int i,j,key;
	for(i=1;i<n;i++){
		key=a[i];
		j=i-g;
		while(j>=0 && a[j]>key){
			a[j+g]=a[j];
			j-=g;
			cnt++;
		}
		a[j+g]=key;
	}
}

void ShellSort(int* a, int n){
	int i;	int m=1;
	int G[100];
	G[1]=n;
	while(1){
		++m;
		G[m]=G[m-1]/3;
		//printf("G[%d]=%d\n",m,G[m]);
		if(G[m]<=1){
			//printf("ERROR: G[%d]=%d\n",m,G[m]);
			G[m]=1;
			break;
		}
	}
		printf("%d\n",m);

	for(i=1;i<=m;i++){
		if(i>1)printf(" ");
		printf("%d",G[i]);
	}printf("\n");
	cnt=0;
	for(i=1;i<=m;i++){
		if(G[i]<=n)InsertionSort(a,n,G[i]);
	}
	printf("%d\n",cnt);
}

int main(){
	int i,n;	scanf("%d",&n);
	int array[1000000];
	for(i=0;i<n;i++)scanf("%d",&array[i]);
	ShellSort(array, n);

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


	return 0;
}

