def insertionSort(A,g):
    global cnt
    
    for i in range(g,len(A)):
        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
            
def shellSort(A):
    global cnt
    cnt = 0
    h = 1
    g = []
    while h <= len(A):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(A,g[i])

    

n = int(input())
A = [int(input()) for i in range(n)] 


shellSort(A)
print(cnt)
for i in A:
    print(i)
             def insertionSort(A,g):
    global cnt
    
    for i in range(g,len(A)):
        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
             insertionSort global cnt for i in range(g,len(A)):
        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,len(A)) range g len(A) len A 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 A A g g def shellSort(A):
    global cnt
    cnt = 0
    h = 1
    g = []
    while h <= len(A):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(A,g[i])

     shellSort global cnt cnt = 0 cnt 0 h = 1 h 1 g = [] g [] while h <= len(A):
        g.append(h)
        h = 3*h+1
     h <= len(A) h len(A) len A g.append(h) g.append g append h h = 3*h+1 h 3*h+1 3*h 3 h 1 g.reverse() g.reverse g reverse m = len(g) m len(g) len g print(m) print m print(' '.join(map(str,g))) print ' '.join(map(str,g)) ' '.join ' ' join map(str,g) map str g for i in range(m):
        insertionSort(A,g[i])

     i range(m) range m insertionSort(A,g[i]) insertionSort A g[i] g i A A n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input A = [int(input()) for i in range(n)] A [int(input()) for i in range(n)] shellSort(A) shellSort A print(cnt) print cnt for i in A:
    print(i)
             i A print(i) print i def shellSort(A):
    global cnt
    cnt = 0
    h = 1
    g = []
    while h <= len(A):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(A,g[i])

     def shellSort(A):
    global cnt
    cnt = 0
    h = 1
    g = []
    while h <= len(A):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(A,g[i])

     shellSort def insertionSort(A,g):
    global cnt
    
    for i in range(g,len(A)):
        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
             def insertionSort(A,g):
    global cnt
    
    for i in range(g,len(A)):
        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
             insertionSort A = [int(input()) for i in range(n)] [int(input()) for i in range(n)] A n = int(input()) int(input()) n
def insertionSort(A,g):
    global cnt
    
    for i in range(g,len(A)):
        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
            
def shellSort(A):
    global cnt
    cnt = 0
    h = 1
    g = []
    while h <= len(A):
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    print(m)
    print(' '.join(map(str,g)))
    for i in range(m):
        insertionSort(A,g[i])

    

n = int(input())
A = [int(input()) for i in range(n)] 


shellSort(A)
print(cnt)
for i in A:
    print(i)
            
