counter=0

def insert(lst,n,g):
    for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v

n=int(input())
lst=[int(input()) for _ in range(n)]
work=n//4
glst=[]
while work>=0:
    glst.append(work+1)
    if work==0 : break
    work//=4

m=len(glst)
for i in range(m):
    insert(lst,n,glst[i])

print(m)
print(" ".join(map(str,glst)))
print(counter)
for i in range(n): print(lst[i])
 counter=0 counter 0 def insert(lst,n,g):
    for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v insert for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v i range(g,n) range g n v=lst[i] v lst[i] lst i j=i-g j i-g i g global counter while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
         j>=0 and lst[j]>v j>=0 j 0 lst[j]>v lst[j] lst j v lst[j+g]=lst[j] lst[j+g] lst j+g j g lst[j] lst j j=j-g j j-g j g counter+=1 counter 1 lst[j+g]=v lst[j+g] lst j+g j g v lst lst n n g g n=int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input lst=[int(input()) for _ in range(n)] lst [int(input()) for _ in range(n)] work=n//4 work n//4 n 4 glst=[] glst [] while work>=0:
    glst.append(work+1)
    if work==0 : break
    work//=4 work>=0 work 0 glst.append(work+1) glst.append glst append work+1 work 1 if work==0 : break
     work==0 work 0 work//=4 work 4 m=len(glst) m len(glst) len glst for i in range(m):
    insert(lst,n,glst[i]) i range(m) range m insert(lst,n,glst[i]) insert lst n glst[i] glst i print(m) print m print(" ".join(map(str,glst))) print " ".join(map(str,glst)) " ".join " " join map(str,glst) map str glst print(counter) print counter for i in range(n): print(lst[i]) i range(n) range n counter=0 0 counter m=len(glst) len(glst) m def insert(lst,n,g):
    for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v def insert(lst,n,g):
    for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v insert n=int(input()) int(input()) n work//=4 4 work glst=[] [] glst lst=[int(input()) for _ in range(n)] [int(input()) for _ in range(n)] lst work=n//4 n//4 work
counter=0

def insert(lst,n,g):
    for i in range(g,n):
        v=lst[i]
        j=i-g
        global counter
        while j>=0 and lst[j]>v:
            lst[j+g]=lst[j]
            j=j-g
            counter+=1
        lst[j+g]=v

n=int(input())
lst=[int(input()) for _ in range(n)]
work=n//4
glst=[]
while work>=0:
    glst.append(work+1)
    if work==0 : break
    work//=4

m=len(glst)
for i in range(m):
    insert(lst,n,glst[i])

print(m)
print(" ".join(map(str,glst)))
print(counter)
for i in range(n): print(lst[i])

