#include<stdio.h>

int m=3,cnt;
int G[3] = {4,3,1};
	
void insertSort(int *a,int n,int g){
	int 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 -= g;
			cnt++;
		}
		a[j+g] = v;
	}
}
void shellSort(int *a,int n){
	
	int m = 3,i;
	for(i=0;i<m;i++)
		insertSort(a,n,G[i]);
}
int main(){
	int n=0;
	FILE *fpout,*fpin;
	fpin = fopen("in1.txt","r");
	fpout=fopen("out1.txt","w");
   fscanf(fpin,"%d",&n);
	int a[n],i;
	for(i=0;i<n;i++)
		fscanf(fpin,"%d",&a[i]);
	cnt = 0;
	shellSort(a,n);
	fprintf(fpout,"%d\n",m);
	for(i=0;i<m-1;i++)
		fprintf(fpout,"%d ",G[i]);
	fprintf(fpout,"%d\n",G[i]);
	fprintf(fpout,"%d\n",cnt);
	for(i=0;i<n;i++)
		fprintf(fpout,"%d\n",a[i]);
	return 0;
}