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

  while (3 * G[m-1] + 1 < n) {
    G[m] = 3 * G[m-1] + 1;
    m++;
  }


  // shellSort(A,n);

  for (i = 0; i < m / 2; i++) {
    v = G[i];
    G[i] = G[m-1-i];
    G[m-1-i] = v;
  }


  for (i = 0; i < m; i++) {
    for (j = G[i]; j < n; j++) {
      v = A[j];
      k = j - G[i];
      while (k >= 0 && A[k] > v) {
    A[k+G[i]] = A[k];
    k -= G[i];
    cnt++;
      }
      A[k+G[i]] = v;
    }
  }


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

  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 v;
  int i,j;
  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;
  }
}