#include<stdio.h>
int insertionSort(int a[],int n,int g);
void shellSort(int a[],int n);
int main(){
	int n;
	scanf("%d",&n);
	int a[1000000];
	int i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	shellSort(a,n);
	for(i=0;i<n;i++){
		printf("%d\n",a[i]);
	}
	return 0;
} 

int insertionSort(int a[],int n,int g){
	int i,v,j,cnt=0;
	for(i=g;i<=n-1;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;
}

void shellSort(int a[],int n){
	int m,flag=1,i=0,cnt=0,cnt1;
	long long g[30];
	g[i]=1;
	while(flag){
		i++;
		g[i]=3*g[i-1]+1;
		if(g[i]>=n||i==20)flag=0;
	}
	i--;
	printf("%d\n",i+1);
	for(cnt1=0;cnt1<i;cnt1++){
		printf("%d ",g[i-cnt1]);
	}
	printf("%d\n",g[0]);
	for(cnt1=0;cnt1<=n;cnt1++){
		cnt+=insertionSort(a,n,g[i-cnt1]);
	}
	printf("%d\n",cnt);
}
