import std.stdio;
import std.array;
import std.string;
import std.algorithm;
import std.conv;

int[] g;

int insertionSort(ref int[] arr, int n, int g) {
  int cnt = 0;
  for (auto i = g; i < n; i++) {
    int v = arr[i];
    int j = i - g;
    while (j >= 0 && arr[j] > v) {
      arr[j+g] = arr[j];
      j = j - g;
      cnt++;
    }
    arr[j+g] = v;
  }
  return cnt;
}

int shellSort(ref int[] arr, int n) {
  int cnt = 0;
  int n_ = n;
  do {
    int g_ = n_ / 2;
    g ~= g_;
    n_ -= g_;
  } while (n_ != 1);
  for (auto i = 0; i < g.length; i++) {
    cnt += insertionSort(arr, n, g[i]);
  }
  return cnt;
}

void main(string[] args)
{
  int n = to!int(strip(readln()));
  int[] arr;
  for (int i = 0; i < n; i++) arr ~= to!int(strip(readln()));
  int cnt = shellSort(arr, n);
  writeln(g.length);
  writeln(join(g.map!(text), " "));
  writeln(cnt);
  foreach(i; arr) { writeln(i); }
}