def insertion_sort(a, n, g):
    ct = 0
    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 -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g


if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n") def insertion_sort(a, n, g):
    ct = 0
    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 -= g
            ct += 1
        a[j+g] = v
    return ct insertion_sort ct = 0 ct 0 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 -= g
            ct += 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 -= g
            ct += 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 -= g j g ct += 1 ct 1 a[j+g] = v a[j+g] a j+g j g v return ct ct a a n n g g def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g interval_list m = 0 m 0 gi= 1 gi 1 g = [] g [] while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
     gi <= n gi n m += 1 m 1 g.append(gi) g.append g append gi gi = 4**m + 3 * 2**(m-1) + 1 gi 4**m + 3 * 2**(m-1) + 1 4**m + 3 * 2**(m-1) 4**m 4 m 3 * 2**(m-1) 3 2**(m-1) 2 m-1 m 1 1 g.reverse() g.reverse g reverse return g g n n if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n") __name__ == "__main__" __name__ "__main__" n = int(input()) n int(input()) int input() input A = list(int(input()) for _ in range(n)) A list(int(input()) for _ in range(n)) list int(input()) int input() input G = interval_list(n) G interval_list(n) interval_list n print(len(G)) print len(G) len G print(*G) print *G G ct= 0 ct 0 for i in G:
        ct += insertion_sort(A, n, i)
     i G ct += insertion_sort(A, n, i) ct insertion_sort(A, n, i) insertion_sort A n i print(ct) print ct print(*A, sep="\n") print *A A sep="\n" sep "\n" def insertion_sort(a, n, g):
    ct = 0
    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 -= g
            ct += 1
        a[j+g] = v
    return ct def insertion_sort(a, n, g):
    ct = 0
    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 -= g
            ct += 1
        a[j+g] = v
    return ct insertion_sort ct= 0 0 ct G = interval_list(n) interval_list(n) G n = int(input()) int(input()) n ct += insertion_sort(A, n, i) insertion_sort(A, n, i) ct A = list(int(input()) for _ in range(n)) list(int(input()) for _ in range(n)) A def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g interval_list
def insertion_sort(a, n, g):
    ct = 0
    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 -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g


if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n")