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

void insert_sort(int *A,int n,int g,int *count){
  int i,key,j;
  for(i=g;i<=n-1;i++){
    key=A[i];
    j=i-g;
    while(key < A[j] && j>=0){
      A[j+g]=A[j]; 
      j-=g;
      count[0]++;
    }
    A[j+g]=key;
  }
}



int main(){
  int i,n,*A,count[1],G[21],m;
  scanf("%d",&n);
  A=malloc(n*sizeof(int));
  while(pow(4,m)<=n){
    G[m]=pow(4,m);
    m+=1;
  }
  if(3==m) G[2]=13;
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  for(i=m-1;i>=0;i--) insert_sort(A,n,G[i],count);
  printf("%d\n",m);
  for(i=m-1;i>0;i--) printf("%d ",G[i]);
  printf("1\n");
  printf("%d\n",count[0]);
  for(i=0;i<=n-1;i++) printf("%d\n",A[i]);
  free(A);
  return 0;
}