N = int(input())
A = []
Cnt = 0

for i in range(N):
    A.append(int(input()))


def InsertSort(g):
    global A, N, Cnt
    for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v


G = []
l = 0
while l <= N:
    G.append(l)
    l = 3 * l + 1
G.reverse()
s = ''
for g in G:
    s += str(g) + ' '
    InsertSort(g)
print(len(G))
print(s.rstrip())
print(Cnt)
for a in A:
    print(a)




 N = int(input()) N int(input()) int input() input A = [] A [] Cnt = 0 Cnt 0 for i in range(N):
    A.append(int(input())) i range(N) range N A.append(int(input())) A.append A append int(input()) int input() input def InsertSort(g):
    global A, N, Cnt
    for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v InsertSort global A, N, Cnt for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v i range(g, N) range g N j = i - g j i - g i g v = A[i] v A[i] A i while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v Cnt += 1 Cnt 1 A[j + g] = A[j] A[j + g] A j + g j g A[j] A j j -= g j g A[j + g] = v A[j + g] A j + g j g v g g G = [] G [] l = 0 l 0 while l <= N:
    G.append(l)
    l = 3 * l + 1 l <= N l N G.append(l) G.append G append l l = 3 * l + 1 l 3 * l + 1 3 * l 3 l 1 G.reverse() G.reverse G reverse s = '' s '' for g in G:
    s += str(g) + ' '
    InsertSort(g) g G s += str(g) + ' ' s str(g) + ' ' str(g) str g ' ' InsertSort(g) InsertSort g print(len(G)) print len(G) len G print(s.rstrip()) print s.rstrip() s.rstrip s rstrip print(Cnt) print Cnt for a in A:
    print(a) a A print(a) print a def InsertSort(g):
    global A, N, Cnt
    for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v def InsertSort(g):
    global A, N, Cnt
    for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v InsertSort Cnt = 0 0 Cnt A = [] [] A N = int(input()) int(input()) N G = [] [] G s += str(g) + ' ' str(g) + ' ' s l = 0 0 l l = 3 * l + 1 3 * l + 1 l s = '' '' s
N = int(input())
A = []
Cnt = 0

for i in range(N):
    A.append(int(input()))


def InsertSort(g):
    global A, N, Cnt
    for i in range(g, N):
        j = i - g
        v = A[i]
        while j >= 0 and A[j] > v:
            Cnt += 1
            A[j + g] = A[j]
            j -= g
        A[j + g] = v


G = []
l = 0
while l <= N:
    G.append(l)
    l = 3 * l + 1
G.reverse()
s = ''
for g in G:
    s += str(g) + ' '
    InsertSort(g)
print(len(G))
print(s.rstrip())
print(Cnt)
for a in A:
    print(a)





