#include<stdio.h>
#include<stdlib.h>

int insertionSort(int *A, int n, int g) {
  int i, j, v;
  int cnt = 0;

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

int shellSort(int *A, int n, int m, int *G) {
  int i;
  int cnt = 0;

  for(i = 0; i < m; i++) {
    cnt += insertionSort(A, n, G[i]);
  }
  return cnt;
}

int main() {
  int n, m,i;
  int cnt = 0;
  int *A;
  int *G;

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

  if(n > 100) {
    m = 100;
  } else {
    m = n-1;
  }
  G = malloc(m*sizeof(int));
  for(i = m; i >= 1; i--) {
    G[m-i] = i;
  }

  cnt = shellSort(A, n, m, G);

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

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

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

  return 0;
}