/** 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 getNumInterval(int n){
  int g=1,m=1;
  
  while((g*3+1)<n && m<101){ //?????????????´???°????¶??????????????????????????????°???100??\?????§??????
    g = g*3 + 1; //new g
//    printf("g: %d\n",g);//@@
    m++;
  }
//  printf("m: %d\n",m);//@@
  
  return m;
}

int insertionSort(int *A, int n, int g){ //A: array, n: length, g: interval

  int i,j,key;

//@@
//  for(i=0;i<n;i++){
//    printf("begin: %d\n", A[i]);
//  }
//  printf("\n");
  
  //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++;
    }
    A[j+g] = key;
  }

  return 0;
}


int main(){
  int i,n,m,g; //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 m
//  m = 2;
  //define G[] --simple-- //m????±????????????????????????????
//  int G[m];
//  G[0] = 4;
//  for(i=1;i<m;i++){
//    if (G[i-1]/2 != 0){
//      G[i] = G[i-1]/2;
//    }else if (G[i-1] == 1){ //?????????g???1?????¨?????????????????????
//      break;
//    }else{
//      G[i] = 1;
//    }
//  }

  //define G[] --complicated--
  m = getNumInterval(n);

  int G[m];
  G[0] = 1; //????????????1
  for(i=1;i<m;i++){
    g = getInterval(G[i-1]);
    G[i] = g;
  }
  
  for(i=0;i<m;i++){
    insertionSort(A, n, G[i]); //A????????§??????
  }

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

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

  return 0;
}