#include <iostream>
#include <algorithm>
using namespace std;

#define MAX 1000000

int a[MAX+1];
int n;
int m = 2;
int g[2] = {2, 1};
int cnt = 0;

void insertionsort(int G) {

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

void shellsort() {

  for(int i=0; i<m; ++i) {
    insertionsort(g[i]);
  }

  cout << cnt << endl;
  for(int i=0; i<n; ++i) {
    cout << a[i] << endl;
  }
}

int main() {
  cin >> n;
  for(int i=0; i<n; ++i) cin >> a[i];

  cout << m << endl;
  for(int i=0; i<m; ++i) cout << g[i] << endl;

  shellsort();

  return 0;
}

