#coding:UTF-8
def iS(N,A,g,cnt):
    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=j-g
            cnt+=1
        A[j+g]=v
    return(cnt)


def sS(N,A):
    cnt=0
    G=[]
    h=1
    while h <= N:
        G.append(h)
        h=3*h+1
    m=len(G)
    print(m)
    G.reverse()
    for i in range(m):
        cnt=iS(N,A,G[i],cnt)
    for i in range(len(G)):
        G[i]=str(G[i])
    print(" ".join(G))
    print(cnt)
    for i in range(len(A)):
        print(A[i])

        
if __name__=="__main__":
    N=int(input())
    A=[]
    for i in range(N):
        A.append(int(input()))
    sS(N,A) def iS(N,A,g,cnt):
    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=j-g
            cnt+=1
        A[j+g]=v
    return(cnt) iS 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=j-g
            cnt+=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=j-g
            cnt+=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=j-g j j-g j g cnt+=1 cnt 1 A[j+g]=v A[j+g] A j+g j g v return(cnt) cnt N N A A g g cnt cnt def sS(N,A):
    cnt=0
    G=[]
    h=1
    while h <= N:
        G.append(h)
        h=3*h+1
    m=len(G)
    print(m)
    G.reverse()
    for i in range(m):
        cnt=iS(N,A,G[i],cnt)
    for i in range(len(G)):
        G[i]=str(G[i])
    print(" ".join(G))
    print(cnt)
    for i in range(len(A)):
        print(A[i])

         sS cnt=0 cnt 0 G=[] G [] h=1 h 1 while h <= N:
        G.append(h)
        h=3*h+1
     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 m=len(G) m len(G) len G print(m) print m G.reverse() G.reverse G reverse for i in range(m):
        cnt=iS(N,A,G[i],cnt)
     i range(m) range m cnt=iS(N,A,G[i],cnt) cnt iS(N,A,G[i],cnt) iS N A G[i] G i cnt for i in range(len(G)):
        G[i]=str(G[i])
     i range(len(G)) range len(G) len G G[i]=str(G[i]) G[i] G i str(G[i]) str G[i] G i print(" ".join(G)) print " ".join(G) " ".join " " join G print(cnt) print cnt for i in range(len(A)):
        print(A[i])

         i range(len(A)) range len(A) len A print(A[i]) print A[i] A i N N A A if __name__=="__main__":
    N=int(input())
    A=[]
    for i in range(N):
        A.append(int(input()))
    sS(N,A) __name__=="__main__" __name__ "__main__" N=int(input()) N int(input()) int input() input A=[] A [] for i in range(N):
        A.append(int(input()))
     i range(N) range N A.append(int(input())) A.append A append int(input()) int input() input sS(N,A) sS N A N=int(input()) int(input()) N A=[] [] A def iS(N,A,g,cnt):
    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=j-g
            cnt+=1
        A[j+g]=v
    return(cnt) def iS(N,A,g,cnt):
    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=j-g
            cnt+=1
        A[j+g]=v
    return(cnt) iS def sS(N,A):
    cnt=0
    G=[]
    h=1
    while h <= N:
        G.append(h)
        h=3*h+1
    m=len(G)
    print(m)
    G.reverse()
    for i in range(m):
        cnt=iS(N,A,G[i],cnt)
    for i in range(len(G)):
        G[i]=str(G[i])
    print(" ".join(G))
    print(cnt)
    for i in range(len(A)):
        print(A[i])

         def sS(N,A):
    cnt=0
    G=[]
    h=1
    while h <= N:
        G.append(h)
        h=3*h+1
    m=len(G)
    print(m)
    G.reverse()
    for i in range(m):
        cnt=iS(N,A,G[i],cnt)
    for i in range(len(G)):
        G[i]=str(G[i])
    print(" ".join(G))
    print(cnt)
    for i in range(len(A)):
        print(A[i])

         sS
#coding:UTF-8
def iS(N,A,g,cnt):
    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=j-g
            cnt+=1
        A[j+g]=v
    return(cnt)


def sS(N,A):
    cnt=0
    G=[]
    h=1
    while h <= N:
        G.append(h)
        h=3*h+1
    m=len(G)
    print(m)
    G.reverse()
    for i in range(m):
        cnt=iS(N,A,G[i],cnt)
    for i in range(len(G)):
        G[i]=str(G[i])
    print(" ".join(G))
    print(cnt)
    for i in range(len(A)):
        print(A[i])

        
if __name__=="__main__":
    N=int(input())
    A=[]
    for i in range(N):
        A.append(int(input()))
    sS(N,A)