using System;
using System.Collections.Generic;
using System.IO;

#region Program
namespace Program
{
    #region Solver
    public class Solver
    {

        public IO.StreamScanner
        sc = new IO.StreamScanner(Console.OpenStandardInput());

        // ?????? ????´???° ??????
        public static int upper = 1000000;

        // ????´???°
        int n;

        // ?????\?????????????????£????????°
        long cnt = 0L;

        // ?????§???????????? ?????£??????
        List<int> G = new List<int>();

        // ??°???
        int[] A = new int[upper];

        #region Solver
        public Solver()
        {
            n = sc.Integer();

            /* ?????????????????? */
            A = sc.Integer(n);

        }
        #endregion

        #region Solve
        public void Solve()
        {
            shellSort(A, n);
            /* ?????? ?????£???????????° */
            Console.WriteLine(G.Count);
            for (int i = G.Count -1; i>=0; i--)
            {
                /* ?????? ?????£??????????????? */
                Console.Write(G[i]);
                if (i > 0)
                {
                    /* ??£??\??????????´??????????1????????????????????? */
                    Console.Write(" ");
                }
            }
            /* ?????? ????°?????????? */
            Console.Write(Environment.NewLine);
            /* ?????? ?????\?????????????????£????????° */
            Console.WriteLine(cnt);
            for (int i = 0; i < A.Length; i++)
            {
                Console.WriteLine(A[i]);
            }
        }
        #endregion

        #region shellSort
        /* ?????§???????????? ?????? g ?????? */
        public void shellSort(int[] A, int n)
        {
            // ??°???G {1, 4, 13, 40, 121, 364, 1093, ...} ?????????
            int h = 1;
            while(h <= n)
            for (int i = 0; h <= n; i++)
            {
                G.Add(h);
                h = 3*h + 1;
            }
            for (int i = G.Count -1; i >=0 ; i--)
            {
                insertionSort(A, G[i]);
            }
        }
        #endregion

        #region insertionSort
        /* ?????? g ????????????????????\????????? */
        public void insertionSort(int[] A, int g)
        {
            int j;
            int v;
            for (int i = g; i < n; i++)
            {
                v = A[i];
                j = i -g;
                while (j >= 0 && A[j] > v)
                {
                    A[j + g] = A[j];
                    j -= g;
                    cnt++;
                }
                A[j + g] = v;
            }
        }
        #endregion
    }
    #endregion
}
#endregion

#region Execute
class Execute
{
    public static void Main(string[] args)
    {
        new Program.Solver().Solve();
    }
}
#endregion

#region Program.IO
namespace Program.IO
{
    using System.Text;
    using System.Globalization;
    using System.Linq;
    public class Printer : StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput())
            {
                AutoFlush = false
            };
        }
        public static Printer Out
        {
            get;
            set;
        }
        public override IFormatProvider FormatProvider
        {
            get
            {
                return CultureInfo.InvariantCulture;
            }
        }
        public Printer(System.IO.Stream stream)
            : base(stream, new UTF8Encoding(false, true))
        {
        }
        public Printer(System.IO.Stream stream, Encoding encoding)
            : base(stream, encoding)
        {
        }
        public void Write<T>(string format, T[] source)
        {
            base.Write(format, source.OfType<object>().ToArray());
        }
        public void WriteLine<T>(string format, T[] source)
        {
            base.WriteLine(format, source.OfType<object>().ToArray());
        }
    }
    public class StreamScanner
    {
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public StreamScanner(Stream stream)
        {
            str = stream;
        }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }
        public long Long()
        {
            if (isEof)
            {
                return long.MinValue;
            }
            long ret = 0;
            byte b = 0;
            var ng = false;
            do
            {
                b = read();
            }
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-')
            {
                ng = true;
                b = read();
            }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                {
                    return ng ? -ret : ret;
                }
                else ret = ret * 10 + b - '0';
            }
        }
        public long[] Long(int n)
        {
            return enumerate(n, Long);
        }
        public int Integer()
        {
            return (isEof) ? int.MinValue : (int)Long();
        }
        public int[] Integer(int n)
        {
            return enumerate(n, Integer);
        }
        public char Char()
        {
            byte b = 0;
            do
            {
                b = read();
            }
            while ((b < 33 || 126 < b) && !isEof);
            return (char)b;
        }
        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
            {
                sb.Append(b);
            }
            return sb.ToString();
        }
        private byte read()
        {
            if (isEof)
            {
                return 0;
            }
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 1024)) <= 0)
                {
                    isEof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
    }
}
#endregion

Measured memory_bytes: 18748