def insertionSort(A, n, g):
    cnt=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 = j - g
            cnt+=1
        A[j+g] = v
    return cnt,A

def shellSort(A, n):
    cnt = 0
    
    G = [1]
    flag=True
    while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
    m = len(G)
    
    for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
    print(m)
    G_str = (list(map(lambda x:str(x),list(G))))
    print(" ".join(G_str))
    print(cnt)
    for a in A:
        print(a)
    #print(A)
    
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellSort(A, n) def insertionSort(A, n, g):
    cnt=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 = j - g
            cnt+=1
        A[j+g] = v
    return cnt,A insertionSort cnt=0 cnt 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 = 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,A return cnt,A cnt A A A n n g g def shellSort(A, n):
    cnt = 0
    
    G = [1]
    flag=True
    while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
    m = len(G)
    
    for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
    print(m)
    G_str = (list(map(lambda x:str(x),list(G))))
    print(" ".join(G_str))
    print(cnt)
    for a in A:
        print(a)
    #print(A)
     shellSort cnt = 0 cnt 0 G = [1] G [1] 1 flag=True flag True while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
     flag g = G[0]*3+1 g G[0]*3+1 G[0]*3 G[0] G 0 3 1 if g < n:
            G = [g] + G
        else:
            flag=False
     g < n g n G = [g] + G G [g] + G [g] g G flag=False flag False m = len(G) m len(G) len G for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
     i range(m) range m tmp_cnt,tmp_A = insertionSort(A, n, G[i]) tmp_cnt insertionSort(A, n, G[i]) insertionSort A n G[i] G i tmp_A cnt += tmp_cnt cnt tmp_cnt print(m) print m G_str = (list(map(lambda x:str(x),list(G)))) G_str list(map(lambda x:str(x),list(G))) list map(lambda x:str(x),list(G)) map lambda x:str(x) str(x) str x x list(G) list G print(" ".join(G_str)) print " ".join(G_str) " ".join " " join G_str print(cnt) print cnt for a in A:
        print(a)
    #print(A)
     a A print(a) print a A A n n 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 shellSort(A, n) shellSort A n A = [] [] A def insertionSort(A, n, g):
    cnt=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 = j - g
            cnt+=1
        A[j+g] = v
    return cnt,A def insertionSort(A, n, g):
    cnt=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 = j - g
            cnt+=1
        A[j+g] = v
    return cnt,A insertionSort def shellSort(A, n):
    cnt = 0
    
    G = [1]
    flag=True
    while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
    m = len(G)
    
    for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
    print(m)
    G_str = (list(map(lambda x:str(x),list(G))))
    print(" ".join(G_str))
    print(cnt)
    for a in A:
        print(a)
    #print(A)
     def shellSort(A, n):
    cnt = 0
    
    G = [1]
    flag=True
    while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
    m = len(G)
    
    for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
    print(m)
    G_str = (list(map(lambda x:str(x),list(G))))
    print(" ".join(G_str))
    print(cnt)
    for a in A:
        print(a)
    #print(A)
     shellSort n = int(input()) int(input()) n
def insertionSort(A, n, g):
    cnt=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 = j - g
            cnt+=1
        A[j+g] = v
    return cnt,A

def shellSort(A, n):
    cnt = 0
    
    G = [1]
    flag=True
    while flag:
        g = G[0]*3+1
        if g < n:
            G = [g] + G
        else:
            flag=False
    m = len(G)
    
    for i in range(m):
        tmp_cnt,tmp_A = insertionSort(A, n, G[i])
        cnt += tmp_cnt
    print(m)
    G_str = (list(map(lambda x:str(x),list(G))))
    print(" ".join(G_str))
    print(cnt)
    for a in A:
        print(a)
    #print(A)
    
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))
shellSort(A, n)
