/** SHELL sort **/
#include <stdio.h>
#include <math.h>

int g_cnt=0,m=1,G[100];

void insertionSort(int *, int, int);
void shellSort(int *, int);


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

  //insertion sort
  for(i=g;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;
  }
}

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

  G[0] = g;
  for(i=1;i<100;i++){ //?????????????´???°???100???????????§????????????g???????????????
    g = 3*g + 1;
    if(g>n) break; //???????????§??????g???????????°????¶??????????????????????
    G[i] = g;
    m++; //????´???°????????????
  }
  
  //call insertion Sort
  for(i=G[m-1];i>=0;i--){
    insertionSort(A, n, G[i]);
  }
}

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

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

  //fill array A
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  /* Sorting */
  //call shellSort
  shellSort(A, n);

  /* printing */
  //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;
}