let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [, ...nums] = content
    .trim()
    .split('\n')
    .map(n => +n);
  shellSort(nums, nums.length);
});

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

let cnt = 0;
const shellSort = (A, n) => {
  const G = [];
  for (let i = 1; Math.pow(2, i) - 1 <= n; i++) {
    G.push(Math.pow(2, i) - 1);
  }
  G.reverse();

  for (let i = 0; i < G.length; i++) {
    insertionSort(A, n, G[i]);
  }

  console.log(G.length);
  console.log(G.join(' '));
  console.log(cnt);
  console.log(A.join('\n'));
};
