var cnt;
function insertionSort(arr, n, g) {
  var j, v;
  for(let i = g; i < n; i++) {
    v = arr[i];
    j = i - g;
    while(j >= 0 && arr[j] > v) {
      arr[j + g] = arr[j];
      j -= g;
      cnt++;
    }
    arr[j + g] = v;
  }
}
function shellSort(arr, n) {
  cnt = 0;
  var m = 1;
  var g_arr = [];
  while(m <= n) {
    g_arr.unshift(m);
    m *= 2;
  }
  console.log(g_arr.length);
  console.log(g_arr.join(" "));
  for(let i = 0; i < m; i++) {
    insertionSort(arr, n, g_arr[i]);
  }
  console.log(cnt);
  console.log(arr.join("\n"));
  // Time comsuming
  /*
  for(let i = 0; i < n; i++) {
    console.log(arr[i]);
  }
  */
}
function Main(input) {
  input = input.split("\n").map(Number);
  var n = input[0];
  var arr = input.slice(1);
  shellSort(arr, n);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

