/** SHELL sort **/

#include <stdio.h>
#include <math.h>

int g_cnt=0;

//?????§????????????????????¬?????????????????£?????????????±???????
//int getInterval(int g){
//  /* ?????¬??????1,2,4???????????????????????????????????? h[n+1]=3*h[n]+1 ??¨?????????????????£??????????????????????????????????????¨?????????
//     ?????????????????£?????????????????¨???1,4,13,40,121...??¨????????°?????????????????????????????????<??\???????´???°??????????????¶?????????????´???????????????? */
//  g = 3*g + 1;
//    
//  return g;
//}

//??????????????????????????°?????????
int getInterval(int g,int m){
  g = g*3 + 1; //new g

  return g;
}

//Insertion Sort
int insertionSort(int *A, int n, int g){ //A: array, n: length, g: interval
  int i,j,key;

  //insertion sort
  for(i=1;i<n;i++){
    key = A[i];
    j = i - g;
    while(j>=0 && A[j]>key){
      A[j+g] = A[j];
      j = j - g;
      g_cnt++; // g_cnt < pow(n,1.5)??£?????????????????????
    }
    A[j+g] = key;
  }

  return 0;
}


//main
int main(){
  int i,n,m=1,g=1; //i: loop, n: length of A[] m: length of G[], g: Interval

  //scan length of A
  scanf("%d",&n);

  //fill array A
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  
  //define G[] --complicated--
  int G[100];
  G[0] = g; //first element
  for(i=1;i<100;i++){
    g = getInterval(G[i-1],m);
    if(g>n) break;
    G[i] = g;
    m++;
  }
  
  //sorting
  for(i=m-1;i>=0;i--){
    insertionSort(A, n, G[i]); //A????????§??????
  }

  //print m
  printf("%d\n",m);

  //print G[]
  for(i=m-1;i>=0;i--){
    if(i==0){
      printf("%d\n",G[i]);
      break;
    }
    printf("%d ",G[i]);
  }
  
  //print g_cnt
  printf("%d\n",g_cnt);
  
  //print sorted A[]
  for(i=0;i<n;i++){
    if(i==n-1){
      printf("%d\n",A[i]);
      break;
    }
    printf("%d \n",A[i]);
  }

  return 0;
}