#include <iostream>


using namespace std;

void insertionsort(int array[], int n, int g){
    int i,j,v;
    for (i=g;i<n;i+=g){
        j=i-g;
        v=array[i];
        while(j>=0 and v<array[j]){
            array[j+g]=array[j];
            j-=g;
        }

        array[j+g]=v;

    }
}

void shellsort(int array[],int n){
    int m=1,i;
    int G[100],temp[100];temp[0]=1;
    for(i=1;i<100;i++){
        temp[i]=3*temp[i-1]+1;
        if(temp[i]>n) break;
        m=i+1;
    }
    for(i=0;i<m;i++)G[i]=temp[m-1-i];
    cout<<m<<endl;
    for (i=0;i<m;i++){
        cout << G[i] << ((i==m-1)?'\n':' ');
    }
    for (i=0;i<m;i++) insertionsort(array, n, G[i]);
}

int main()
{
    int n,i,k;
    cin >> n;
    int array[n];
    for (i=0;i<n;i++){
        cin>>array[i];
    }
    shellsort(array,n);

    for (k=0;k<n;k++){
        cout << array[k] << '\n';
    }

}
