import sys
if sys.version_info[0]>=3: raw_input=input

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
    g = []
    h = 1
    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])


a=[int(raw_input()) for i in range(int(raw_input()))]
shellSort(a)
print(cnt)
for e in a: print(e) import sys sys if sys.version_info[0]>=3: raw_input=input sys.version_info[0]>=3 sys.version_info[0] sys.version_info sys version_info 0 3 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
            a[j+g] = v 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
    g = []
    h = 1
    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 g = [] g [] h = 1 h 1 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 int(raw_input()) for i in range(int(raw_input())) for i in range(int(raw_input())) i range(int(raw_input())) range int(raw_input()) int raw_input() raw_input for i in range(int(raw_input())) int(raw_input()) int raw_input() raw_input a=[int(raw_input()) for i in range(int(raw_input()))] a [int(raw_input()) for i in range(int(raw_input()))] shellSort(a) shellSort a print(cnt) print cnt for e in a: print(e) e a def shellSort(a):
    global cnt
    cnt = 0
    g = []
    h = 1
    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
    g = []
    h = 1
    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(raw_input()) for i in range(int(raw_input()))] [int(raw_input()) for i in range(int(raw_input()))] a
import sys
if sys.version_info[0]>=3: raw_input=input

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
    g = []
    h = 1
    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])


a=[int(raw_input()) for i in range(int(raw_input()))]
shellSort(a)
print(cnt)
for e in a: print(e)