using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetNumber();
            var list = Enumerable.Range(0, N).Select(x => int.Parse(Console.ReadLine().Trim())).ToArray();
            var m = new LinkedList<int>();
            m.AddLast(1);
            while (true)
            {
                var v = m.Last() * 3 + 1;
                if (v < N / 9)
                {
                    m.AddLast(v);
                }
                else
                {
                    break;
                }
            }

            var count = 0;
            while (true)
            {
                count = shellSort(list.ToArray(), N, m.Reverse().ToArray());
                if (count <= Math.Pow(N, 1.5))
                {
                    break;
                }
                m.AddLast(m.Last() * 3 + 1);
            }

            System.Console.WriteLine(m.Count);
            System.Console.WriteLine(string.Join(" ", m.Reverse().Select(x => x.ToString()).ToArray()));
            System.Console.WriteLine(count);
            foreach (var item in list.OrderBy(x => x))
            {
                System.Console.WriteLine(item);
            }
        }

        //static StreamReader Console = new StreamReader("input.txt");

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

        static int shellSort(int[] A, int n, int[] m)
        {
            var cnt = 0;
            for (int i = 0; i < m.Length; i++)
            {
                cnt = insertionSort(A, n, m[i], cnt);
            }
            return cnt;
        }

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static int[] GetNumbersInt(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static long[] GetNumbersLong(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToArray();
        }

        static double[] GetNumbersDouble(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => double.Parse(x)).ToArray();
        }

        static string[] GetStrings(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
        }
    }
}

Measured memory_bytes: 41516