#include<stdio.h>
int cnt,A[10000001];

void insertionSort(int n, int g) {
  int i,j,v;
  for (i=g;i<=n-1;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;
  }
}

void shellSort(int n){
  int i,m;
  cnt = 0;
  m = 2;
  int G[2] = {4,1};
  printf("%d\n",m);
  for (i=0;i<m;i++){
    if (i!=0){
      printf(" ");
    }
    printf("%d",G[i]);
  }
  printf("\n");
  for (i=0; i<=m-1; i++){
    insertionSort(n, G[i]);
  }
}

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

  shellSort(n);
  printf("%d\n",cnt);
  for (i=0;i<n;i++){
    printf("%d\n",A[i]);
  }
  return 0;
}