#include<stdio.h>
#define N 10^6
int G[N],cnt = 0;
void insertionSort(int A[], int n, int g);
void shellSort(int A[], int n);
main(){
  int i,n,A[N],v,k,j;
  scanf("%d",&n);
  for(i = 0; i < n; i++) scanf("%d",&A[i]);



   shellSort(A,n);



  printf("%d\n",cnt);

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

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

 void shellSort(int A[], int n){
   int i,m=0,v;

  while (3 * G[m-1] + 1 < n) {
    G[m] = 3 * G[m-1] + 1;
    m++;
  }

  for (i = 0; i < m / 2; i++) {
    v = G[i];
    G[i] = G[m-1-i];
    G[m-1-i] = v;
  }

  printf("%d\n",m);
  for(i = 0; i < m; i++) printf("%d ",G[i]);
  printf("\n");

  cnt = 0;
  for (i = 0; i < m; i++) {
    insertionSort(A,n,G[i]);
  }
}