#include<stdio.h>

#define N 100000

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

int main(){

  int i, j;
  int n;
  int a[N];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  shellSort(a, n);

  return 0;
}


int insertionSort(int *A,int n,int g){

  int i, j;
  int v;
  int cnt=0;
  
  for (i = g;i <= n-1;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;
  }
  return cnt;
}






void shellSort(int *A,int n){

  int i;
  int m=5;
  int cnt;
  int mcnt;
  int G[5]={5000,400,30,20,1};
  
  cnt=0;
  mcnt=0;
  
  for(i = 0;i < m;i++){
    if(G[i] <= n){
      cnt = cnt + insertionSort(A,n,G[i]);
    mcnt++;
    }
  }
  printf("%d\n",mcnt);

  
  for(i = 0;i < m-1;i++){
    if(G[i] <= n){
      printf("%d",G[i]);
    }
  }

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

}