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

def shell_sort(data):
    global G
    for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
    for g in list(reversed(G)):
        insertion_sort(data, g)

G, cnt = [], 0
n = int(input())
data = list(int(input()) for _ in range(n))
shell_sort(data)
print(len(G))
print(' '.join(map(str, list(reversed(G)))))
print(cnt)
print('\n'.join(map(str, data))) def insertion_sort(data, g):
    global cnt
    for i in range(g, len(data)):
        v, j = data[i], i - g
        while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
        data[j + g] = v insertion_sort global cnt for i in range(g, len(data)):
        v, j = data[i], i - g
        while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
        data[j + g] = v i range(g, len(data)) range g len(data) len data v, j = data[i], i - g v data[i] data i j i - g i g while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
         j >= 0 and data[j] > v j >= 0 j 0 data[j] > v data[j] data j v data[j + g] = data[j] data[j + g] data j + g j g data[j] data j j = j - g j j - g j g cnt += 1 cnt 1 data[j + g] = v data[j + g] data j + g j g v data data g g def shell_sort(data):
    global G
    for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
    for g in list(reversed(G)):
        insertion_sort(data, g) shell_sort global G for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
     i range(1, 100) range 1 100 tmp = (3 ** i - 1) // 2 tmp (3 ** i - 1) // 2 3 ** i - 1 3 ** i 3 i 1 2 if tmp > len(data):
            break
         tmp > len(data) tmp len(data) len data break G.append(tmp) G.append G append tmp for g in list(reversed(G)):
        insertion_sort(data, g) g list(reversed(G)) list reversed(G) reversed G insertion_sort(data, g) insertion_sort data g data data G, cnt = [], 0 G [] cnt 0 n = int(input()) n int(input()) int input() input data = list(int(input()) for _ in range(n)) data list(int(input()) for _ in range(n)) list int(input()) int input() input shell_sort(data) shell_sort data print(len(G)) print len(G) len G print(' '.join(map(str, list(reversed(G))))) print ' '.join(map(str, list(reversed(G)))) ' '.join ' ' join map(str, list(reversed(G))) map str list(reversed(G)) list reversed(G) reversed G print(cnt) print cnt print('\n'.join(map(str, data))) print '\n'.join(map(str, data)) '\n'.join '\n' join map(str, data) map str data cnt = [], 0 0 cnt def insertion_sort(data, g):
    global cnt
    for i in range(g, len(data)):
        v, j = data[i], i - g
        while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
        data[j + g] = v def insertion_sort(data, g):
    global cnt
    for i in range(g, len(data)):
        v, j = data[i], i - g
        while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
        data[j + g] = v insertion_sort G, cnt = [], 0 [] G n = int(input()) int(input()) n data = list(int(input()) for _ in range(n)) list(int(input()) for _ in range(n)) data def shell_sort(data):
    global G
    for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
    for g in list(reversed(G)):
        insertion_sort(data, g) def shell_sort(data):
    global G
    for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
    for g in list(reversed(G)):
        insertion_sort(data, g) shell_sort
def insertion_sort(data, g):
    global cnt
    for i in range(g, len(data)):
        v, j = data[i], i - g
        while j >= 0 and data[j] > v:
            data[j + g] = data[j]
            j = j - g
            cnt += 1
        data[j + g] = v

def shell_sort(data):
    global G
    for i in range(1, 100):
        tmp = (3 ** i - 1) // 2
        if tmp > len(data):
            break
        G.append(tmp)
    for g in list(reversed(G)):
        insertion_sort(data, g)

G, cnt = [], 0
n = int(input())
data = list(int(input()) for _ in range(n))
shell_sort(data)
print(len(G))
print(' '.join(map(str, list(reversed(G)))))
print(cnt)
print('\n'.join(map(str, data)))