N = int(input())
lst = [int(input()) for i  in range(N)]

def insertion_sort(A, n, g):
    global 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 = j - g
            cnt += 1
        A[j+g] = v

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

cnt = 0
G = [1]
for i in range(99):
    if N < 1 + 3*G[-1]:
        break
    G.append(1 + 3*G[-1])
m = len(G)
G.reverse()

shell_sort(lst, N, m, G)

print(m)
print(" ".join(list(map(str, G))))
print(cnt)
for i in lst:
    print(i) N = int(input()) N int(input()) int input() input int(input()) for i  in range(N) for i  in range(N) i range(N) range N for i  in range(N) int(input()) int input() input lst = [int(input()) for i  in range(N)] lst [int(input()) for i  in range(N)] def insertion_sort(A, n, g):
    global 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 = j - g
            cnt += 1
        A[j+g] = v insertion_sort global 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 = 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 = 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 A A n n g g def shell_sort(A, n, m, G):    
    for i in range(m):
        insertion_sort(A, n, G[i]) shell_sort for i in range(m):
        insertion_sort(A, n, G[i]) i range(m) range m insertion_sort(A, n, G[i]) insertion_sort A n G[i] G i A A n n m m G G cnt = 0 cnt 0 G = [1] G [1] 1 for i in range(99):
    if N < 1 + 3*G[-1]:
        break
    G.append(1 + 3*G[-1]) i range(99) range 99 if N < 1 + 3*G[-1]:
        break
     N < 1 + 3*G[-1] N 1 + 3*G[-1] 1 3*G[-1] 3 G[-1] G -1 break G.append(1 + 3*G[-1]) G.append G append 1 + 3*G[-1] 1 3*G[-1] 3 G[-1] G -1 m = len(G) m len(G) len G G.reverse() G.reverse G reverse shell_sort(lst, N, m, G) shell_sort lst N m G print(m) print m print(" ".join(list(map(str, G)))) print " ".join(list(map(str, G))) " ".join " " join list(map(str, G)) list map(str, G) map str G print(cnt) print cnt for i in lst:
    print(i) i lst print(i) print i m = len(G) len(G) m def insertion_sort(A, n, g):
    global 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 = j - g
            cnt += 1
        A[j+g] = v def insertion_sort(A, n, g):
    global 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 = j - g
            cnt += 1
        A[j+g] = v insertion_sort def shell_sort(A, n, m, G):    
    for i in range(m):
        insertion_sort(A, n, G[i]) def shell_sort(A, n, m, G):    
    for i in range(m):
        insertion_sort(A, n, G[i]) shell_sort cnt = 0 0 cnt G = [1] [1] G lst = [int(input()) for i  in range(N)] [int(input()) for i  in range(N)] lst N = int(input()) int(input()) N
N = int(input())
lst = [int(input()) for i  in range(N)]

def insertion_sort(A, n, g):
    global 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 = j - g
            cnt += 1
        A[j+g] = v

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

cnt = 0
G = [1]
for i in range(99):
    if N < 1 + 3*G[-1]:
        break
    G.append(1 + 3*G[-1])
m = len(G)
G.reverse()

shell_sort(lst, N, m, G)

print(m)
print(" ".join(list(map(str, G))))
print(cnt)
for i in lst:
    print(i)
