#include <stdio.h>

void insertion(int [], int, int);

int cnt = 0;

int main(){
  int i, n, m = 5, A[1000000], G[] = {5, 4, 3, 2, 1};

  scanf("%d", &n);

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

  for(i=0; i<m; i++) insertion(A, n, G[i]);

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

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

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