# coding: utf-8

cnt = int()
m = int()
g = []

def insersion_sort(a, n, g):
    global cnt
    for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return list(a)

def shell_sort(a, n):
    global cnt
    global m
    global g
    cnt = 0
    m = 0
    g = []
    nn = n
    while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
    if n == 1:
        m = 1
        g = [1]
    for i in g:
        a = insersion_sort(a, n, i)
    return a

def main():
    global cnt
    global m
    global g
    n = input()
    a = []
    for i in xrange(n):
        a.append(input())
    a = shell_sort(a, n)
    print m
    print " ".join(map(str, g))
    print cnt
    for i in xrange(n):
        print a[i]

main() cnt = int() cnt int() int m = int() m int() int g = [] g [] def insersion_sort(a, n, g):
    global cnt
    for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return list(a) insersion_sort global cnt for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
     i xrange(g, n) xrange g n v = a[i] v a[i] a i j = i - g j i - g i g while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
         j >= 0 and a[j] > v j >= 0 j 0 a[j] > v a[j] a j v a[j+g] = a[j] a[j+g] a j+g j g a[j] a j j = j - g j j - g j g cnt += 1 cnt 1 a[j+g] = v a[j+g] a j+g j g v return list(a) list(a) list a a a n n g g def shell_sort(a, n):
    global cnt
    global m
    global g
    cnt = 0
    m = 0
    g = []
    nn = n
    while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
    if n == 1:
        m = 1
        g = [1]
    for i in g:
        a = insersion_sort(a, n, i)
    return a shell_sort global cnt global m global g cnt = 0 cnt 0 m = 0 m 0 g = [] g [] nn = n nn n while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
     True nn /= 2 nn 2 if nn <= 0:
            break
         nn <= 0 nn 0 break g.append(nn) g.append g append nn m += 1 m 1 if n == 1:
        m = 1
        g = [1]
     n == 1 n 1 m = 1 m 1 g = [1] g [1] 1 for i in g:
        a = insersion_sort(a, n, i)
     i g a = insersion_sort(a, n, i) a insersion_sort(a, n, i) insersion_sort a n i return a a a a n n def main():
    global cnt
    global m
    global g
    n = input()
    a = []
    for i in xrange(n):
        a.append(input())
    a = shell_sort(a, n)
    print m
    print " ".join(map(str, g))
    print cnt
    for i in xrange(n):
        print a[i] main global cnt global m global g n = input() n input() input a = [] a [] for i in xrange(n):
        a.append(input())
     i xrange(n) xrange n a.append(input()) a.append a append input() input a = shell_sort(a, n) a shell_sort(a, n) shell_sort a n print print " ".join(map(str, g)) " ".join " " join map(str, g) map str g print for i in xrange(n):
        print a[i] i xrange(n) xrange n print a[i] a i main() main def insersion_sort(a, n, g):
    global cnt
    for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return list(a) def insersion_sort(a, n, g):
    global cnt
    for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return list(a) insersion_sort m = int() int() m cnt = int() int() cnt g = [] [] g def shell_sort(a, n):
    global cnt
    global m
    global g
    cnt = 0
    m = 0
    g = []
    nn = n
    while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
    if n == 1:
        m = 1
        g = [1]
    for i in g:
        a = insersion_sort(a, n, i)
    return a def shell_sort(a, n):
    global cnt
    global m
    global g
    cnt = 0
    m = 0
    g = []
    nn = n
    while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
    if n == 1:
        m = 1
        g = [1]
    for i in g:
        a = insersion_sort(a, n, i)
    return a shell_sort def main():
    global cnt
    global m
    global g
    n = input()
    a = []
    for i in xrange(n):
        a.append(input())
    a = shell_sort(a, n)
    print m
    print " ".join(map(str, g))
    print cnt
    for i in xrange(n):
        print a[i] def main():
    global cnt
    global m
    global g
    n = input()
    a = []
    for i in xrange(n):
        a.append(input())
    a = shell_sort(a, n)
    print m
    print " ".join(map(str, g))
    print cnt
    for i in xrange(n):
        print a[i] main
# coding: utf-8

cnt = int()
m = int()
g = []

def insersion_sort(a, n, g):
    global cnt
    for i in xrange(g, n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j - g
            cnt += 1
        a[j+g] = v
    return list(a)

def shell_sort(a, n):
    global cnt
    global m
    global g
    cnt = 0
    m = 0
    g = []
    nn = n
    while True:
        nn /= 2
        if nn <= 0:
            break
        g.append(nn)
        m += 1
    if n == 1:
        m = 1
        g = [1]
    for i in g:
        a = insersion_sort(a, n, i)
    return a

def main():
    global cnt
    global m
    global g
    n = input()
    a = []
    for i in xrange(n):
        a.append(input())
    a = shell_sort(a, n)
    print m
    print " ".join(map(str, g))
    print cnt
    for i in xrange(n):
        print a[i]

main()