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

int G[] = {1,8,23,77,281,1073,4193,16577,65921,262913,1050113};

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

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

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