#include <iostream>
#include <vector>

int cnt = 0;
void  insertionSort(std::vector<int> &a, const int n, const int g){
    for (auto i = g; i < n; ++i){
        auto v = a.at(i);
        auto j = i - g;
        while (j >= 0 and a.at(j) > v){
            a.at(j + g) = a.at(j);
            j -= g;
            ++cnt;
        }
        a.at(j + g) = v;
    }
}
void shellSort(std::vector<int>& vect, const int n){
    cnt = 0;
    auto m = vect.size() / 3;
    std::vector<int> g;
    g.push_back(m);
    for (auto i = 1; i < m; ++i)
        g.push_back((g.back() - 1) / 3);
    for (auto v:g)
        insertionSort(vect, n, v);
    std::cout <<  m << '\n' << g.front();
    for (auto i = g.begin() + 1; i != g.end(); ++i)
        std::cout << " " << *i;
    std::cout << '\n' << cnt << '\n';
    for (auto i:vect)
        std::cout << i << '\n';
}
int main(){
    int n;
    std::cin >> n;
    std::vector<int> vect;
    for (auto i = 0; i < n; ++i){
        int temp;
        std::cin >> temp;
        vect.push_back(temp);
    }
    shellSort(vect, n);
}