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

def shell_sort(a,n,G):
    cnt=0
    for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
    return a,cnt

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

g = 1
G = [g]
while True:
    g = 3*g + 1
    if g > n:
        break
    G.append(g)

G = sorted(G,reverse=True)

a,cnt = shell_sort(a,n,G)
print len(G)
print ' '.join([str(v) for v in G])
print cnt
for v in a:
    print v def insertion_sort(a,n,g,cnt):
    for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            cnt+=1
        a[j+g] = v
    return a,cnt insertion_sort for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            cnt+=1
        a[j+g] = v
     i range(g,n) range 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 -= 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 -= g j g cnt+=1 cnt 1 a[j+g] = v a[j+g] a j+g j g v return a,cnt return a,cnt a cnt a a n n g g cnt cnt def shell_sort(a,n,G):
    cnt=0
    for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
    return a,cnt shell_sort cnt=0 cnt 0 for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
     g G a,cnt = insertion_sort(a,n,g,cnt) a insertion_sort(a,n,g,cnt) insertion_sort a n g cnt cnt return a,cnt return a,cnt a cnt a a n n G G n = int(raw_input()) n int(raw_input()) int raw_input() raw_input a = [] a [] for i in range(n):
    a.append(int(raw_input())) i range(n) range n a.append(int(raw_input())) a.append a append int(raw_input()) int raw_input() raw_input g = 1 g 1 G = [g] G [g] g while True:
    g = 3*g + 1
    if g > n:
        break
    G.append(g) True g = 3*g + 1 g 3*g + 1 3*g 3 g 1 if g > n:
        break
     g > n g n break G.append(g) G.append G append g G = sorted(G,reverse=True) G sorted(G,reverse=True) sorted G reverse=True reverse True a,cnt = shell_sort(a,n,G) a shell_sort(a,n,G) shell_sort a n G cnt print len(G) len G print str(v) for v in G for v in G v G for v in G str(v) str v ' '.join([str(v) for v in G]) ' '.join ' ' join [str(v) for v in G] print for v in a:
    print v v a print def shell_sort(a,n,G):
    cnt=0
    for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
    return a,cnt def shell_sort(a,n,G):
    cnt=0
    for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
    return a,cnt shell_sort n = int(raw_input()) int(raw_input()) n G = [g] [g] G cnt = shell_sort(a,n,G) shell_sort(a,n,G) cnt g = 1 1 g g = 3*g + 1 3*g + 1 g G = sorted(G,reverse=True) sorted(G,reverse=True) G a,cnt = shell_sort(a,n,G) shell_sort(a,n,G) a a = [] [] a def insertion_sort(a,n,g,cnt):
    for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            cnt+=1
        a[j+g] = v
    return a,cnt def insertion_sort(a,n,g,cnt):
    for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            cnt+=1
        a[j+g] = v
    return a,cnt insertion_sort
def insertion_sort(a,n,g,cnt):
    for i in range(g,n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            cnt+=1
        a[j+g] = v
    return a,cnt

def shell_sort(a,n,G):
    cnt=0
    for g in G:
        a,cnt = insertion_sort(a,n,g,cnt)
    return a,cnt

n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

g = 1
G = [g]
while True:
    g = 3*g + 1
    if g > n:
        break
    G.append(g)

G = sorted(G,reverse=True)

a,cnt = shell_sort(a,n,G)
print len(G)
print ' '.join([str(v) for v in G])
print cnt
for v in a:
    print v