

G = [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1]

def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v

def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i)


n = int(input())
arr = [int(input()) for i in range(n)] + [0]
Gn = [i for i in G if i <= n]


shell_sort(arr,Gn)
print(len(Gn))
print(' '.join([str(i) for i in Gn]))
print(arr[-1])
[print(i) for i in arr[:-1]] G = [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1] G [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1] 120001 60001 30001 15001 3001 901 601 301 91 58 31 7 4 1 def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v insertion_sort for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v i range(g,len(array)-1) range g len(array)-1 len(array) len array 1 v = array[i] v array[i] array i j = i-g j i-g i g while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
         j>=0 and array[j] > v j>=0 j 0 array[j] > v array[j] array j v array[j+g] = array[j] array[j+g] array j+g j g array[j] array j j = j-g j j-g j g array[-1] += 1 array[-1] array -1 1 array[j+g] = v array[j+g] array j+g j g v array array g g def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i) shell_sort for i in G:
        insertion_sort(array,i) i G insertion_sort(array,i) insertion_sort array i array array G G 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 arr = [int(input()) for i in range(n)] + [0] arr [int(input()) for i in range(n)] + [0] [int(input()) for i in range(n)] [0] 0 i for i in G if i <= n for i in G if i <= n i G i <= n i n if i <= n i Gn = [i for i in G if i <= n] Gn [i for i in G if i <= n] shell_sort(arr,Gn) shell_sort arr Gn print(len(Gn)) print len(Gn) len Gn str(i) for i in Gn for i in Gn i Gn for i in Gn str(i) str i print(' '.join([str(i) for i in Gn])) print ' '.join([str(i) for i in Gn]) ' '.join ' ' join [str(i) for i in Gn] print(arr[-1]) print arr[-1] arr -1 print(i) for i in arr[:-1] for i in arr[:-1] i arr[:-1] arr :-1 -1 for i in arr[:-1] print(i) print i [print(i) for i in arr[:-1]] arr = [int(input()) for i in range(n)] + [0] [int(input()) for i in range(n)] + [0] arr n = int(input()) int(input()) n G = [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1] [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1] G Gn = [i for i in G if i <= n] [i for i in G if i <= n] Gn def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v insertion_sort def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i) def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i) shell_sort


G = [120001,60001,30001,15001,3001,901,601,301,91,58,31,7,4,1]

def insertion_sort(array,g):
    for i in range(g,len(array)-1):
        v = array[i]
        j = i-g
        while j>=0 and array[j] > v:
            array[j+g] = array[j]
            j = j-g
            array[-1] += 1
        array[j+g] = v

def shell_sort(array,G):
    for i in G:
        insertion_sort(array,i)


n = int(input())
arr = [int(input()) for i in range(n)] + [0]
Gn = [i for i in G if i <= n]


shell_sort(arr,Gn)
print(len(Gn))
print(' '.join([str(i) for i in Gn]))
print(arr[-1])
[print(i) for i in arr[:-1]]