#include<stdlib.h>
#include<stdio.h>
#include<string.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 j,i,n,*A,count[1]={0},G[5]={16,8,4,2,1},m;
  scanf("%d",&n);
  A=malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  for(i=0;i<5;i++){
    if((n/2)>=G[i]){
      insert_sort(A,n,G[i],count);
      m+=1;
    }
  }
  printf("%d\n",m);
  for(i=5-m;i<=3;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]);
  printf("%d\n",A[n-1]);
  return 0;
}