var cnt = 0;

var insertionSort = function(a, n, g) {
  for (var i = g; i < n; i += 1) {
    var v = a[i];
    j = i -g;
    while (j >= 0 && a[j] > v) {
      a[j + g] = a[j];
      j = j - g;
      cnt += 1;
    }
    a[j + g] = v;
  }
};

var shellSort = function(a, n) {
  var g = [];
  for (var i = 1; i <= n; i = i * 3 + 1) {
    g.push(i);
  }
  var m = g.length;
  console.log(m);
  console.log(g.join(' '));
  for (i = 0; i < m; i += 1) {
    insertionSort(a, n, g[i]);
  }
};

var stdin = require('fs').readFileSync('/dev/stdin', 'utf8');
var nums = stdin.split('\n').map(Number);
var n = nums.shift();
shellSort(nums, n);
console.log(cnt);
nums.forEach(function(num) {
  console.log(num);
});