#include <stdio.h>

#define min(a,b) a < b ? a : b


void shellsort(void);
void insertionsort(int);

int a[1000000];
int n;
int G[100];
int m;

int count;
  int p=0;

int main(){
    //int n;
    int i;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    shellsort();
    
    printf("%d\n" ,m);
    for(i = 0 ; i < m ; i++){
        if(i != m-1){
            printf("%d " ,G[i]);
        }else{
            printf("%d\n" ,G[i]);
        }
    }
    printf("%d\n" ,count);
    for(i = 0 ; i < n ; i++){
        printf("%d\n" ,a[i]);
    }

    
    return 0;
}

void shellsort(void){
    
  
    int i;
    
    count =0;
    
    for(m=1;m*3+1<n;m=m*3+1){};
    for(;m>0;m=m/3){
        G[p]=m;
        p++;
    }
    
    p = min(p,100);
    for(i=0;i<p;i++){
        insertionsort(G[i]);
    }
    //print(int m);
}

void insertionsort(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;
            count++;
        }
        a[j+g]=v;
    }
    
    
}