#include <stdio.h>

int c=0;
void insertSort(int arr[],int n ,int g){
	for (int  i = g; i < n;i++){
	  int v = arr[i];
      int j = i - g;
      while ( j >= 0 && arr[j] > v){
        arr[ j +g] = arr[ j];
        j = j-g;
        c++;
      }
      arr[ j +g] =v;
	}
};
void shellSort(int A[],int n){
	
	int m = (n - 1) /3;
	int G [5]= {1,4,13,40,121};
	printf("%d\n",m+1);
	for (int i= m;i >= 0;i--){
		printf("%d ",G[i]);
		insertSort(A,n,G[i]);
	}
	printf("\n");
};
int main(){

  int n ,i ,j , m ,t,g ,k ,v;
  scanf("%d" ,&n);
  int arr[n];
  for ( i = 0; i < n; i++){
    scanf("%d",&arr[i]);
  }
shellSort(arr,n);
  printf("%d\n",c);

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


  return 0;

}

