def insert_sort(L,n,g):
    cnt =0
    for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
    return cnt


if __name__ == '__main__':
    n = int(input())
    L = []
    G = []
    h = 1
    cnt = 0
    for _ in range(n):
        L.append(int(input()))
    while 1:
        if h > n: break
        G.append(h)
        h = 3*h + 1
    G = G[::-1]
    for gap in G:
        cnt += insert_sort(L,n,gap)
    print(len(G))
    print(*G)
    print(cnt)
    for i  in range(n): 
        print(L[i]) def insert_sort(L,n,g):
    cnt =0
    for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
    return cnt insert_sort cnt =0 cnt 0 for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
     i range(g,n) range g n v = L[i] v L[i] L i j = i-g j i-g i g while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
         j >= 0 and L[j] > v j >= 0 j 0 L[j] > v L[j] L j v L[j+g] = L[j] L[j+g] L j+g j g L[j] L j j = j-g j j-g j g cnt +=1 cnt 1 L[j+g] = v L[j+g] L j+g j g v return cnt cnt L L n n g g if __name__ == '__main__':
    n = int(input())
    L = []
    G = []
    h = 1
    cnt = 0
    for _ in range(n):
        L.append(int(input()))
    while 1:
        if h > n: break
        G.append(h)
        h = 3*h + 1
    G = G[::-1]
    for gap in G:
        cnt += insert_sort(L,n,gap)
    print(len(G))
    print(*G)
    print(cnt)
    for i  in range(n): 
        print(L[i]) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input L = [] L [] G = [] G [] h = 1 h 1 cnt = 0 cnt 0 for _ in range(n):
        L.append(int(input()))
     _ range(n) range n L.append(int(input())) L.append L append int(input()) int input() input while 1:
        if h > n: break
        G.append(h)
        h = 3*h + 1
     1 if h > n: break
         h > n h n G.append(h) G.append G append h h = 3*h + 1 h 3*h + 1 3*h 3 h 1 G = G[::-1] G G[::-1] G ::-1 -1 for gap in G:
        cnt += insert_sort(L,n,gap)
     gap G cnt += insert_sort(L,n,gap) cnt insert_sort(L,n,gap) insert_sort L n gap print(len(G)) print len(G) len G print(*G) print *G G print(cnt) print cnt for i  in range(n): 
        print(L[i]) i range(n) range n print(L[i]) print L[i] L i G = G[::-1] G[::-1] G n = int(input()) int(input()) n def insert_sort(L,n,g):
    cnt =0
    for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
    return cnt def insert_sort(L,n,g):
    cnt =0
    for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
    return cnt insert_sort L = [] [] L h = 1 1 h cnt = 0 0 cnt h = 3*h + 1 3*h + 1 h cnt += insert_sort(L,n,gap) insert_sort(L,n,gap) cnt G = [] [] G
def insert_sort(L,n,g):
    cnt =0
    for i in range(g,n):
        v = L[i]
        j = i-g
        while j >= 0 and L[j] > v:
            L[j+g] = L[j]
            j = j-g
            cnt +=1
        L[j+g] = v
    return cnt


if __name__ == '__main__':
    n = int(input())
    L = []
    G = []
    h = 1
    cnt = 0
    for _ in range(n):
        L.append(int(input()))
    while 1:
        if h > n: break
        G.append(h)
        h = 3*h + 1
    G = G[::-1]
    for gap in G:
        cnt += insert_sort(L,n,gap)
    print(len(G))
    print(*G)
    print(cnt)
    for i  in range(n): 
        print(L[i])
