#include<stdio.h>
#include<string.h>
#define N 1000000

void shellSort(int *,int);
void insertionSort(int *,int,int);
int cnt=0,G[101],m;

int main(){
  int n,i;
  scanf("%d",&n);
  int A[n];

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

  shellSort(A,n);


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

  return 0;
}

void shellSort(int A[],int n){
  int i,k;
  G[0] = 1;
  for(i=1;;i++){
    k = i * 3 + 1;
    if(k > n){
      break;
    }
    G[i] = k;
  }
  m = i - 1;
  for(i=0;i<=m-1;i++){
    insertionSort(A,n,G[i]);
  }
}


void insertionSort(int A[],int n,int G){
  int v,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;
      
    }
    A[j+G] = v;
    cnt++;
  }
}

