#グローバル変数
count = int()
interval = int()
interval_list = list()

#アルゴリズム：挿入ソート
def insertionSort(list, number, interval):
    for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
    return list

#アルゴリズム：シェルソート
def shellSort(list, number):
    global count, interval, interval_list
    count = 0
    interval = 1
    interval_list.append(1)
    while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
    for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
    return list

#初期data
input_number = int(input())
input_list = list()
for i in range(input_number):
    input_list.append(int(input()))

#処理の実行
result_list = list()
result_list = shellSort(input_list, input_number)

#結果の表示
print(interval)
print(" ".join(map(str, interval_list)))
print(count)
[print(i) for i in result_list]
 count = int() count int() int interval = int() interval int() int interval_list = list() interval_list list() list def insertionSort(list, number, interval):
    for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
    return list

#アルゴリズム：シェルソート insertionSort for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
     i range(interval, number) range interval number v = list[i] v list[i] list i j = i - interval j i - interval i interval while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
         j >= 0 and list[j] > v j >= 0 j 0 list[j] > v list[j] list j v list[j + interval] = list[j] list[j + interval] list j + interval j interval list[j] list j j = j - interval j j - interval j interval global count count += 1 count 1 list[j + interval] = v list[j + interval] list j + interval j interval v return list list list list number number interval interval def shellSort(list, number):
    global count, interval, interval_list
    count = 0
    interval = 1
    interval_list.append(1)
    while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
    for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
    return list

#初期data shellSort global count, interval, interval_list count = 0 count 0 interval = 1 interval 1 interval_list.append(1) interval_list.append interval_list append 1 while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
     number >= 3*interval_list[0]+1 number 3*interval_list[0]+1 3*interval_list[0] 3 interval_list[0] interval_list 0 1 interval_list.insert(0, 3*interval_list[0]+1) interval_list.insert interval_list insert 0 3*interval_list[0]+1 3*interval_list[0] 3 interval_list[0] interval_list 0 1 interval += 1 interval 1 for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
     i range(interval) range interval list = insertionSort(list, number, interval_list[i]) list insertionSort(list, number, interval_list[i]) insertionSort list number interval_list[i] interval_list i return list list list list number number input_number = int(input()) input_number int(input()) int input() input input_list = list() input_list list() list for i in range(input_number):
    input_list.append(int(input()))

#処理の実行 i range(input_number) range input_number input_list.append(int(input())) input_list.append input_list append int(input()) int input() input result_list = list() result_list list() list result_list = shellSort(input_list, input_number) result_list shellSort(input_list, input_number) shellSort input_list input_number print(interval) print interval print(" ".join(map(str, interval_list))) print " ".join(map(str, interval_list)) " ".join " " join map(str, interval_list) map str interval_list print(count) print count print(i) for i in result_list for i in result_list i result_list for i in result_list print(i) print i [print(i) for i in result_list] interval = int() int() interval def shellSort(list, number):
    global count, interval, interval_list
    count = 0
    interval = 1
    interval_list.append(1)
    while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
    for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
    return list

#初期data def shellSort(list, number):
    global count, interval, interval_list
    count = 0
    interval = 1
    interval_list.append(1)
    while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
    for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
    return list

#初期data shellSort interval_list = list() list() interval_list input_list = list() list() input_list result_list = list() list() result_list result_list = shellSort(input_list, input_number) shellSort(input_list, input_number) result_list input_number = int(input()) int(input()) input_number def insertionSort(list, number, interval):
    for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
    return list

#アルゴリズム：シェルソート def insertionSort(list, number, interval):
    for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
    return list

#アルゴリズム：シェルソート insertionSort count = int() int() count
#グローバル変数
count = int()
interval = int()
interval_list = list()

#アルゴリズム：挿入ソート
def insertionSort(list, number, interval):
    for i in range(interval, number):
        v = list[i]
        j = i - interval
        while j >= 0 and list[j] > v:
            list[j + interval] = list[j]
            j = j - interval
            global count
            count += 1
        list[j + interval] = v
    return list

#アルゴリズム：シェルソート
def shellSort(list, number):
    global count, interval, interval_list
    count = 0
    interval = 1
    interval_list.append(1)
    while number >= 3*interval_list[0]+1:
        interval_list.insert(0, 3*interval_list[0]+1)
        interval += 1
    for i in range(interval):
        list = insertionSort(list, number, interval_list[i])
    return list

#初期data
input_number = int(input())
input_list = list()
for i in range(input_number):
    input_list.append(int(input()))

#処理の実行
result_list = list()
result_list = shellSort(input_list, input_number)

#結果の表示
print(interval)
print(" ".join(map(str, interval_list)))
print(count)
[print(i) for i in result_list]

