#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)
#define cube(x) (x) * (x) * (x)

const int INF = 1e9;

using namespace std;
int cnt = 0;

vector<int> insertion_sort(vector<int> a, int n, int g) {

    for(int i=g; i<n; i++){
        int key = a[i];
        int j = i - g;
        while(j >= 0 && a[j] > key){
            a[j+g] = a[j];
            j -= g;
            cnt++;
        }
        a[j+g] = key;
    }
    return a;
}

vector<int> shell_sort(vector<int> a, int n){
    cnt = 0;
    int m = 11;
    int mm = m;
    int g[] = {1, 2, 8, 32, 128, 512, 2048, 2048*4, 2048*16, 2048*64, 2048*256};
    REP(i, m){
        if(g[m-1-i] > n)
            mm--;
    }
    cout << mm << endl;
    REP(i, mm-1){
        cout << g[mm-1-i] << " ";
        a = insertion_sort(a, n, g[mm-1-i]);
    }
    cout << g[0] << endl;
    a = insertion_sort(a, n, g[0]);

    return a;

}
/*
vector<string> selection_sort(vector<string> s){
    int n = s.size();
    vector<int> a;
    REP(i, n)
        a.push_back(atoi(s[i].substr(1, 1).c_str()));

    REP(i, n){
        int mini = i;
        for(int j = i; j < n ; j++){
            if(a[j] < a[mini])
                mini = j;
        }
        if(i != mini){
            swap(a[i], a[mini]);
            swap(s[i], s[mini]);
        }
    }
    return s;
}

vector<string> bubble_sort(vector<string> s) {
    int n = s.size();
    vector<int> a;
    REP(i, n)
        a.push_back(atoi(s[i].substr(1, 1).c_str()));

    REP(i, n)
        for(int j = n - 1; j > i; j--)
            if(a[j] < a[j-1]){
                swap(a[j], a[j-1]);
                swap(s[j], s[j-1]);
            }

    return s;
}

int find(vector<string> target, string query){
    int i = 0;
    vector<string>::iterator iter = target.begin();
    while(iter != target.end()){
        if (*iter == query)
            break;
        i++;
        iter++;
    }

    return i;
}
*/

int main() {
    int n;
    cin >> n;
    int in[n];
    vector<int> a;
    REP(i, n) { cin >> in[i]; a.push_back(in[i]);}
    a = shell_sort(a, n);
    cout << cnt << endl;
    REP(i, n)
        cout << a[i] << endl;

    return 0;
}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
#define dpr(x) cerr<<#x<<": "<<x<<endl;
#define dprc(c) do{cerr<<#c<<":";for(auto&_i:(c)){cerr<<" "<<_i;}cerr<<endl;}while(0)
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int INF = 1e9+7;
#define all(c) begin(c), end(c)
#define tr(i,c) for(auto i=begin(c);i!=end(c);i++)
#define rtr(i,c) for(auto i=(c).rbegin();i!=(c).rend();i++)
#define rep(i,b) for(auto i=0;i<(b);i++)
#define pb push_back
#define sz(c) int((c).size())

int cnt, m;
vi G;

void insertionSort(vi& A, int n, int g) {
  for (int i = g; i < n; i++) {
    int v = A[i];
    int j = i - g;
    while (j >= 0 && A[j] > v) {
      A[j+g] = A[j];
      j = j - g;
      cnt++;
    }
    A[j+g] = v;
  }
}

void shellSort(vi& A, int n) {
  cnt = 0;
  G = vi(0);
  int g = 1;
  do {
    G.pb(g);
    g = g*3 + 1;
  } while (g <= n);
  reverse(all(G));
  m = sz(G);
  for (auto& g:G) {
    insertionSort(A, n, g);
  }
}

void dump(vi& A, const string& sep) {
  string sp = "";
  for (auto& a:A) {
    cout << sp << a;
    sp = sep;
  }
  cout << endl;
}

int main(int argc, char **argv)
{
  vi A;
  int n;
  cin >> n;
  A = vi(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  shellSort(A, n);

  cout << m << endl;
  dump(G, " ");
  cout << cnt << endl;
  dump(A, "\n");
  return 0;
}