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


def shell_sort(r, n):
    global m
    global G
    h = 1
    while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
    m = len(G)
    G.reverse()
    for i in range(m):
        insertion_sort(r, n, G[i])

cnt = 0
G = []
m = 0
N = int(input())
R = [int(input()) for i in range(N)]
shell_sort(R, N)
print(m)
print(*G)
print(cnt)
for i in range(N):
    print(R[i]) def insertion_sort(r, n, g):
    global cnt
    for i in range(g, n):
        v = r[i]
        j = i - g
        while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
        r[j + g] = v insertion_sort global cnt for i in range(g, n):
        v = r[i]
        j = i - g
        while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
        r[j + g] = v i range(g, n) range g n v = r[i] v r[i] r i j = i - g j i - g i g while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
         v < r[j] and j >= 0 v < r[j] v r[j] r j j >= 0 j 0 r[j + g] = r[j] r[j + g] r j + g j g r[j] r j j = j - g j j - g j g cnt += 1 cnt 1 r[j + g] = v r[j + g] r j + g j g v r r n n g g def shell_sort(r, n):
    global m
    global G
    h = 1
    while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
    m = len(G)
    G.reverse()
    for i in range(m):
        insertion_sort(r, n, G[i]) shell_sort global m global G h = 1 h 1 while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
     True if h > n:
            break
         h > n h n break G.append(h) G.append G append h h = h * 3 + 1 h h * 3 + 1 h * 3 h 3 1 m = len(G) m len(G) len G G.reverse() G.reverse G reverse for i in range(m):
        insertion_sort(r, n, G[i]) i range(m) range m insertion_sort(r, n, G[i]) insertion_sort r n G[i] G i r r n n cnt = 0 cnt 0 G = [] G [] m = 0 m 0 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 R = [int(input()) for i in range(N)] R [int(input()) for i in range(N)] shell_sort(R, N) shell_sort R N print(m) print m print(*G) print *G G print(cnt) print cnt for i in range(N):
    print(R[i]) i range(N) range N print(R[i]) print R[i] R i N = int(input()) int(input()) N def insertion_sort(r, n, g):
    global cnt
    for i in range(g, n):
        v = r[i]
        j = i - g
        while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
        r[j + g] = v def insertion_sort(r, n, g):
    global cnt
    for i in range(g, n):
        v = r[i]
        j = i - g
        while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
        r[j + g] = v insertion_sort G = [] [] G def shell_sort(r, n):
    global m
    global G
    h = 1
    while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
    m = len(G)
    G.reverse()
    for i in range(m):
        insertion_sort(r, n, G[i]) def shell_sort(r, n):
    global m
    global G
    h = 1
    while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
    m = len(G)
    G.reverse()
    for i in range(m):
        insertion_sort(r, n, G[i]) shell_sort R = [int(input()) for i in range(N)] [int(input()) for i in range(N)] R cnt = 0 0 cnt m = 0 0 m
def insertion_sort(r, n, g):
    global cnt
    for i in range(g, n):
        v = r[i]
        j = i - g
        while v < r[j] and j >= 0:
            r[j + g] = r[j]
            j = j - g
            cnt += 1
        r[j + g] = v


def shell_sort(r, n):
    global m
    global G
    h = 1
    while True:
        if h > n:
            break
        G.append(h)
        h = h * 3 + 1
    m = len(G)
    G.reverse()
    for i in range(m):
        insertion_sort(r, n, G[i])

cnt = 0
G = []
m = 0
N = int(input())
R = [int(input()) for i in range(N)]
shell_sort(R, N)
print(m)
print(*G)
print(cnt)
for i in range(N):
    print(R[i])