def insertion(A, n, g):
    global cnt
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1

def main():
    global cnt
    cnt = 0
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = 1
    k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    for i in G:
        insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j)

main() def insertion(A, n, g):
    global cnt
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1 insertion global cnt for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1 i range(g, n) range g n while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1 i >= g and A[i - g] > A[i] i >= g i g A[i - g] > A[i] A[i - g] A i - g i g A[i] A i A[i], A[i - g] = A[i - g], A[i] A[i] A i A[i - g] A i - g i g A[i - g] A i - g i g A[i] A i i -= g i g cnt += 1 cnt 1 A A n n g g def main():
    global cnt
    cnt = 0
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = 1
    k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    for i in G:
        insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j) main global cnt cnt = 0 cnt 0 n = int(raw_input()) n int(raw_input()) int raw_input() raw_input int(raw_input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(raw_input()) int raw_input() raw_input A = [int(raw_input()) for i in range(n)] A [int(raw_input()) for i in range(n)] G = list() G list() list h = 1 h 1 k = 1 k 1 while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
     h <= n h n G.append(h) G.append G append h h = (4 ** k) + (3 * (2 ** (k - 1)) + 1) h (4 ** k) + (3 * (2 ** (k - 1)) + 1) 4 ** k 4 k 3 * (2 ** (k - 1)) + 1 3 * (2 ** (k - 1)) 3 2 ** (k - 1) 2 k - 1 k 1 1 k += 1 k 1 G = G[::-1] G G[::-1] G ::-1 -1 for i in G:
        insertion(A, n, i)

     i G insertion(A, n, i) insertion A n i print(len(G)) print len(G) len G print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print(cnt) print cnt for j in A: prin j A main() main def main():
    global cnt
    cnt = 0
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = 1
    k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    for i in G:
        insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j) def main():
    global cnt
    cnt = 0
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = 1
    k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    for i in G:
        insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j) main def insertion(A, n, g):
    global cnt
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1 def insertion(A, n, g):
    global cnt
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1 insertion
def insertion(A, n, g):
    global cnt
    for i in range(g, n):
        while i >= g and A[i - g] > A[i]:
            A[i], A[i - g] = A[i - g], A[i]
            i -= g
            cnt += 1

def main():
    global cnt
    cnt = 0
    n = int(raw_input())
    A = [int(raw_input()) for i in range(n)]

    G = list()
    h = 1
    k = 1
    while h <= n:
        G.append(h)
        h = (4 ** k) + (3 * (2 ** (k - 1)) + 1)
        k += 1
    G = G[::-1]

    for i in G:
        insertion(A, n, i)

    print(len(G))
    print(" ".join(map(str, G)))
    print(cnt)
    for j in A: print(j)

main()