/*挿入ソート*/
#include <stdio.h>
#include <stdlib.h>
#define N 1000001

void insertionSort(int *, int, int);

int cnt=0;

int main()
{
  int i, j, n, m;
  int g[N], A[N];
  
  scanf("%d", &n);
  for (i=0; i<n; i++){
    scanf("%d", &A[i]);
  }

  m = n/2;

  g[m-1] = 1;
  for (i=m-2; i>=0; i--){
    g[i] = 3*g[i+1]+1;
  }

  for (i=0; i<m; i++){
    insertionSort(A, n, g[i]);
  }
  
  /*結果の出力*/
  printf("%d\n", m);

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

  printf("%d\n", cnt);

  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;
      cnt++;
    }
    A[j+g] = v;
  }
}

