def insertion_sort(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

def shell_sort(A,n):
    cnt = 0
    
    G = []
    val = 1
    while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
    G.reverse()
    m = len(G)

    for g in G:
        cnt += insertion_sort(A,n,g)

    #output
    print(m)
    print(*G)
    print(cnt)
    for a in A:
        print(a)

n = int(input())
#print(f"#dbg n:{n}")
A = []
for i in range(n):
    A.append(int(input()))

#print("#dbg A:",*A)

shell_sort(A,n)



    
    


 def insertion_sort(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 insertion_sort 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 cnt A A n n g g def shell_sort(A,n):
    cnt = 0
    
    G = []
    val = 1
    while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
    G.reverse()
    m = len(G)

    for g in G:
        cnt += insertion_sort(A,n,g)

    #output
    print(m)
    print(*G)
    print(cnt)
    for a in A:
        print(a) shell_sort cnt = 0 cnt 0 G = [] G [] val = 1 val 1 while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
     True G.append(val) G.append G append val val = (3 * val) + 1 val (3 * val) + 1 3 * val 3 val 1 if val > (n // 3) + 1:
            break
    
     val > (n // 3) + 1 val (n // 3) + 1 n // 3 n 3 1 break G.reverse() G.reverse G reverse m = len(G) m len(G) len G for g in G:
        cnt += insertion_sort(A,n,g)

    #output
     g G cnt += insertion_sort(A,n,g) cnt insertion_sort(A,n,g) insertion_sort A n g print(m) print m print(*G) print *G G print(cnt) print cnt for a in 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()))

#print("#dbg A:",*A) i range(n) range n A.append(int(input())) A.append A append int(input()) int input() input shell_sort(A,n) shell_sort A n def shell_sort(A,n):
    cnt = 0
    
    G = []
    val = 1
    while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
    G.reverse()
    m = len(G)

    for g in G:
        cnt += insertion_sort(A,n,g)

    #output
    print(m)
    print(*G)
    print(cnt)
    for a in A:
        print(a) def shell_sort(A,n):
    cnt = 0
    
    G = []
    val = 1
    while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
    G.reverse()
    m = len(G)

    for g in G:
        cnt += insertion_sort(A,n,g)

    #output
    print(m)
    print(*G)
    print(cnt)
    for a in A:
        print(a) shell_sort A = [] [] A n = int(input()) int(input()) n def insertion_sort(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 def insertion_sort(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 insertion_sort
def insertion_sort(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

def shell_sort(A,n):
    cnt = 0
    
    G = []
    val = 1
    while True:
        G.append(val)
        val = (3 * val) + 1
        if val > (n // 3) + 1:
            break
    
    G.reverse()
    m = len(G)

    for g in G:
        cnt += insertion_sort(A,n,g)

    #output
    print(m)
    print(*G)
    print(cnt)
    for a in A:
        print(a)

n = int(input())
#print(f"#dbg n:{n}")
A = []
for i in range(n):
    A.append(int(input()))

#print("#dbg A:",*A)

shell_sort(A,n)



    
    



