#include <stdio.h>
int N = 1;
int cnt = 0;
int array[10000];
int g[7] = {3413,853,213,53,13,4,1};

void move(int width, int n, int location) {
int d, k = n;
d = array[n];

  while(k > location){
   array[k] = array[k-width];
   k -= width;
   cnt++;
 }
 array[location] = d;

}

void sort(){
int i = 0, j = 0, k = 0;

while(i <= 6){
 while(g[i] + j <= N - 1){

   while(k < g[i] + j){
     if(array[k] > array[g[i] + j]){
       move(g[i], g[i] + j, k);

     }

     k += g[i];
   }

 j += 1;
 k = j % g[i];
 }

i += 1;
j = 0;
k = 0;
}

}
int main(){
int i, m = 0;

scanf("%d", &N);
 for(i = 0; i <= N - 1; i++)
  scanf("%d", &array[i]);

 for(i = 0; i <= 6; i++){
  if(g[i] <= N){
   m += 1;
  }
 }
 printf("%d\n", m);
 for(i = 0; i <= 6; i++){
  if(g[i] <= N){
   printf("%d ", g[i]);
  }

 }
sort();
 printf("\n");
 printf("%d\n", cnt);
 for(i = 0; i <= N - 1; i++)
  printf("%d\n", array[i]);

return 0;
}