def insertion_sort(l, n, g):
    global count
    for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v


def shell_sort(l, n):
    for i in range(m):
        insertion_sort(l, n, G[i])


def make_g(length):
    if length == 1:
        return [1]

    G = []
    while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
    return G


n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

count = 0
G = make_g(len(l))
m = len(G)

shell_sort(l, n)

print(m)
print(' '.join(map(str, G)))
print(count)
for i in l:
    print(i)
 def insertion_sort(l, n, g):
    global count
    for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v insertion_sort global count for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v i range(g, n) range g n v = l[i] v l[i] l i j = i - g j i - g i g while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
         j >= 0 and l[j] > v j >= 0 j 0 l[j] > v l[j] l j v l[j + g] = l[j] l[j + g] l j + g j g l[j] l j j -= g j g count += 1 count 1 l[j + g] = v l[j + g] l j + g j g v l l n n g g def shell_sort(l, n):
    for i in range(m):
        insertion_sort(l, n, G[i]) shell_sort for i in range(m):
        insertion_sort(l, n, G[i]) i range(m) range m insertion_sort(l, n, G[i]) insertion_sort l n G[i] G i l l n n def make_g(length):
    if length == 1:
        return [1]

    G = []
    while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
    return G make_g if length == 1:
        return [1]

     length == 1 length 1 return [1] [1] 1 G = [] G [] while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
     True if length == 1:
            break
         length == 1 length 1 break G.append(length // 2) G.append G append length // 2 length 2 length //= 2 length 2 return G G length length n = int(input()) n int(input()) int input() input l = [] l [] for i in range(n):
    l.append(int(input())) i range(n) range n l.append(int(input())) l.append l append int(input()) int input() input count = 0 count 0 G = make_g(len(l)) G make_g(len(l)) make_g len(l) len l m = len(G) m len(G) len G shell_sort(l, n) shell_sort l n print(m) print m print(' '.join(map(str, G))) print ' '.join(map(str, G)) ' '.join ' ' join map(str, G) map str G print(count) print count for i in l:
    print(i) i l print(i) print i G = make_g(len(l)) make_g(len(l)) G m = len(G) len(G) m def shell_sort(l, n):
    for i in range(m):
        insertion_sort(l, n, G[i]) def shell_sort(l, n):
    for i in range(m):
        insertion_sort(l, n, G[i]) shell_sort def make_g(length):
    if length == 1:
        return [1]

    G = []
    while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
    return G def make_g(length):
    if length == 1:
        return [1]

    G = []
    while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
    return G make_g n = int(input()) int(input()) n def insertion_sort(l, n, g):
    global count
    for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v def insertion_sort(l, n, g):
    global count
    for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v insertion_sort l = [] [] l count = 0 0 count
def insertion_sort(l, n, g):
    global count
    for i in range(g, n):
        v = l[i]
        j = i - g
        while j >= 0 and l[j] > v:
            l[j + g] = l[j]
            j -= g
            count += 1
        l[j + g] = v


def shell_sort(l, n):
    for i in range(m):
        insertion_sort(l, n, G[i])


def make_g(length):
    if length == 1:
        return [1]

    G = []
    while True:
        if length == 1:
            break
        G.append(length // 2)
        length //= 2
    return G


n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

count = 0
G = make_g(len(l))
m = len(G)

shell_sort(l, n)

print(m)
print(' '.join(map(str, G)))
print(count)
for i in l:
    print(i)

