#include <stdio.h>

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

int A[1000000],G[1000000],n,count,glen;

int main(){
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  shellSort(A,n);
  printf("%d\n",glen);
  for(i=glen-1;i>0;i--) printf("%d ",G[i]);
  printf("%d\n",G[i]);
  printf("%d\n",count);
  for(i=0;i<n;i++) printf("%d\n",A[i]);
  return 0;
}

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

void shellSort(int *A,int n){
  int i,j,h;
  count = 0;
  for(h=1,i=0;h<n;i++){
    G[i] = h;
    h = 3*h+1;
  }
  glen = i;
  for(j=i-1;j>=0;j--) insertionSort(A,n,G[j]);
}