#coding: utf-8

def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line)


def insertion_sort(A, n, g):
    global counter
    for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val

def shell_sort(A, n):
    global counter
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n]
    m = len(G)
    for i in range(0, m):
        insertion_sort(A, n, G[i])
    print(m)
    print(*G)
    print(counter)
    for i in range(n):
        print(A[i])


n = int(input())
A = [int(input()) for x in range(n)]
counter = 0

shell_sort(A, n) def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line) print_list first_flag = True first_flag True for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
     val X if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
     first_flag print_line = str(val) print_line str(val) str val first_flag = False first_flag False print_line = print_line + ' ' + str(val) print_line print_line + ' ' + str(val) print_line + ' ' print_line ' ' str(val) str val print(print_line) print print_line X X def insertion_sort(A, n, g):
    global counter
    for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val insertion_sort global counter for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val i range(g, n) range g n tmp_val = A[i] tmp_val A[i] A i j = i - g j i - g i g while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
         (j >= 0) and (A[j] > tmp_val) j >= 0 j 0 A[j] > tmp_val A[j] A j tmp_val A[j+g] = A[j] A[j+g] A j+g j g A[j] A j j -= g j g counter += 1 counter 1 A[j+g] = tmp_val A[j+g] A j+g j g tmp_val A A n n g g def shell_sort(A, n):
    global counter
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n]
    m = len(G)
    for i in range(0, m):
        insertion_sort(A, n, G[i])
    print(m)
    print(*G)
    print(counter)
    for i in range(n):
        print(A[i]) shell_sort global counter i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n i [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] 262913 65921 16577 4193 1073 281 77 13 4 1 i <= n i n if i <= n i G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n] G [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n] m = len(G) m len(G) len G for i in range(0, m):
        insertion_sort(A, n, G[i])
     i range(0, m) range 0 m insertion_sort(A, n, G[i]) insertion_sort A n G[i] G i print(m) print m print(*G) print *G G print(counter) print counter for i in range(n):
        print(A[i]) i range(n) range n print(A[i]) print A[i] A i A A n n n = int(input()) n int(input()) int input() input int(input()) for x in range(n) for x in range(n) x range(n) range n for x in range(n) int(input()) int input() input A = [int(input()) for x in range(n)] A [int(input()) for x in range(n)] counter = 0 counter 0 shell_sort(A, n) shell_sort A n def shell_sort(A, n):
    global counter
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n]
    m = len(G)
    for i in range(0, m):
        insertion_sort(A, n, G[i])
    print(m)
    print(*G)
    print(counter)
    for i in range(n):
        print(A[i]) def shell_sort(A, n):
    global counter
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n]
    m = len(G)
    for i in range(0, m):
        insertion_sort(A, n, G[i])
    print(m)
    print(*G)
    print(counter)
    for i in range(n):
        print(A[i]) shell_sort def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line) def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line) print_list n = int(input()) int(input()) n def insertion_sort(A, n, g):
    global counter
    for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val def insertion_sort(A, n, g):
    global counter
    for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val insertion_sort counter = 0 0 counter A = [int(input()) for x in range(n)] [int(input()) for x in range(n)] A
#coding: utf-8

def print_list(X):
    first_flag = True
    for val in X:
        if first_flag:
            print_line = str(val)
            first_flag = False
        else:
            print_line = print_line + ' ' + str(val)
    print(print_line)


def insertion_sort(A, n, g):
    global counter
    for i in range(g, n):
        tmp_val = A[i]
        j = i - g
        #print("tmp_val:", tmp_val, "A:", *A)
        while (j >= 0) and (A[j] > tmp_val):
            A[j+g] = A[j]
            j -= g
            counter += 1
            #print("tmp_val:", tmp_val, "A:", *A)
        A[j+g] = tmp_val

def shell_sort(A, n):
    global counter
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 13, 4, 1] if i <= n]
    m = len(G)
    for i in range(0, m):
        insertion_sort(A, n, G[i])
    print(m)
    print(*G)
    print(counter)
    for i in range(n):
        print(A[i])


n = int(input())
A = [int(input()) for x in range(n)]
counter = 0

shell_sort(A, n)