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

def shellsort(a,n):
    global cnt
    cnt=0
    g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m=len(g)
    #print(g,m)
    for i in range(m):
        insertionSort(a,n,g[i])
    return a,m,g

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

a,m,g=shellsort(a,n)

print(m)
print(*g)
print(cnt)
for i in a:
    print(i) def insertionSort(a,n,g):
    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
            global cnt
            cnt+=1
        a[j+g]=v insertionSort 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
            global cnt
            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
            global cnt
            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 global cnt cnt+=1 cnt 1 a[j+g]=v a[j+g] a j+g j g v a a n n g g def shellsort(a,n):
    global cnt
    cnt=0
    g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m=len(g)
    #print(g,m)
    for i in range(m):
        insertionSort(a,n,g[i])
    return a,m,g shellsort global cnt cnt=0 cnt 0 i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n i [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] 262913 65921 16577 4193 1073 281 77 23 8 1 i <= n i n if i <= n i g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] g [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] m=len(g) m len(g) len g for i in range(m):
        insertionSort(a,n,g[i])
     i range(m) range m insertionSort(a,n,g[i]) insertionSort a n g[i] g i return a,m,g return a,m,g a m g a a n n 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)] a,m,g=shellsort(a,n) a shellsort(a,n) shellsort a n m g print(m) print m print(*g) print *g g print(cnt) print cnt for i in a:
    print(i) i a print(i) print i a=[int(input()) for i in range(n)] [int(input()) for i in range(n)] a g=shellsort(a,n) shellsort(a,n) g a,m,g=shellsort(a,n) shellsort(a,n) a def shellsort(a,n):
    global cnt
    cnt=0
    g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m=len(g)
    #print(g,m)
    for i in range(m):
        insertionSort(a,n,g[i])
    return a,m,g def shellsort(a,n):
    global cnt
    cnt=0
    g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m=len(g)
    #print(g,m)
    for i in range(m):
        insertionSort(a,n,g[i])
    return a,m,g shellsort n=int(input()) int(input()) n m,g=shellsort(a,n) shellsort(a,n) m def insertionSort(a,n,g):
    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
            global cnt
            cnt+=1
        a[j+g]=v def insertionSort(a,n,g):
    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
            global cnt
            cnt+=1
        a[j+g]=v insertionSort
def insertionSort(a,n,g):
    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
            global cnt
            cnt+=1
        a[j+g]=v

def shellsort(a,n):
    global cnt
    cnt=0
    g=[i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m=len(g)
    #print(g,m)
    for i in range(m):
        insertionSort(a,n,g[i])
    return a,m,g

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

a,m,g=shellsort(a,n)

print(m)
print(*g)
print(cnt)
for i in a:
    print(i)