#include<stdio.h>
#include<math.h>

#define N 1000000

int main(){
  int inser[N];
  int i,j,g,value;
  int num,cnt;
  int m;
  int shell[N];
  int k;

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

  //shellsort
  cnt = 0;

  j=0;

  for(i=num/2;i>0;i=i/2){
    shell[j] = i;
    j++;
  }
  m=j+1;
    
  for(k=0;k<=m-1;k++){
    //insertionsort
    for(i=shell[k];i<=num-1;i++){
      value = inser[i];
      j = i - shell[k];
      while(j>=0 && inser[j] > value){
	inser[j+shell[k]] = inser[j];
	j = j - shell[k];
	cnt++;
	inser[j+shell[k]] = value;
      }
    }
  }

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

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

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



