# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
# Shell Sort
# Result:
import sys
import math

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

def shell_sort(ary):
    ary_len = len(ary)
    gs = []
    v = ary_len
    while v > 0:
        gs.append(v)
        v >>= 1
    m = len(gs)

    cnt = 0
    for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
    return [m, gs, cnt]

lines = sys.stdin.readlines()
ary_len = int(lines.pop(0))
ary = map(int, lines)
assert ary_len == len(ary)

m, gs, cnt = shell_sort(ary)
print m
print ' '.join(map(str, gs))
print cnt
for v in ary:
    print v import sys sys import math math def insertion_sort(ary, g):
    cnt = 0
    ary_len = len(ary)
    for i in range(g, ary_len):
        v = ary[i]
        j = i - g
        while (j >= 0 and ary[j] > v):
            ary[j + g] = ary[j]
            j -= g
            cnt += 1
        ary[j + g] = v
    return cnt insertion_sort cnt = 0 cnt 0 ary_len = len(ary) ary_len len(ary) len ary for i in range(g, ary_len):
        v = ary[i]
        j = i - g
        while (j >= 0 and ary[j] > v):
            ary[j + g] = ary[j]
            j -= g
            cnt += 1
        ary[j + g] = v
     i range(g, ary_len) range g ary_len v = ary[i] v ary[i] ary i j = i - g j i - g i g while (j >= 0 and ary[j] > v):
            ary[j + g] = ary[j]
            j -= g
            cnt += 1
         j >= 0 and ary[j] > v j >= 0 j 0 ary[j] > v ary[j] ary j v ary[j + g] = ary[j] ary[j + g] ary j + g j g ary[j] ary j j -= g j g cnt += 1 cnt 1 ary[j + g] = v ary[j + g] ary j + g j g v return cnt cnt ary ary g g def shell_sort(ary):
    ary_len = len(ary)
    gs = []
    v = ary_len
    while v > 0:
        gs.append(v)
        v >>= 1
    m = len(gs)

    cnt = 0
    for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
    return [m, gs, cnt] shell_sort ary_len = len(ary) ary_len len(ary) len ary gs = [] gs [] v = ary_len v ary_len while v > 0:
        gs.append(v)
        v >>= 1
     v > 0 v 0 gs.append(v) gs.append gs append v v >>= 1 v 1 m = len(gs) m len(gs) len gs cnt = 0 cnt 0 for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
     i range(0, m) range 0 m cnt += insertion_sort(ary, gs[i]) cnt insertion_sort(ary, gs[i]) insertion_sort ary gs[i] gs i return [m, gs, cnt] [m, gs, cnt] m gs cnt ary ary lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines ary_len = int(lines.pop(0)) ary_len int(lines.pop(0)) int lines.pop(0) lines.pop lines pop 0 ary = map(int, lines) ary map(int, lines) map int lines assert ary_len == len(ary) ary_len == len(ary) ary_len len(ary) len ary m, gs, cnt = shell_sort(ary) m shell_sort(ary) shell_sort ary gs cnt print print ' '.join(map(str, gs)) ' '.join ' ' join map(str, gs) map str gs print for v in ary:
    print v v ary print def insertion_sort(ary, g):
    cnt = 0
    ary_len = len(ary)
    for i in range(g, ary_len):
        v = ary[i]
        j = i - g
        while (j >= 0 and ary[j] > v):
            ary[j + g] = ary[j]
            j -= g
            cnt += 1
        ary[j + g] = v
    return cnt def insertion_sort(ary, g):
    cnt = 0
    ary_len = len(ary)
    for i in range(g, ary_len):
        v = ary[i]
        j = i - g
        while (j >= 0 and ary[j] > v):
            ary[j + g] = ary[j]
            j -= g
            cnt += 1
        ary[j + g] = v
    return cnt insertion_sort m, gs, cnt = shell_sort(ary) shell_sort(ary) m cnt = shell_sort(ary) shell_sort(ary) cnt ary = map(int, lines) map(int, lines) ary def shell_sort(ary):
    ary_len = len(ary)
    gs = []
    v = ary_len
    while v > 0:
        gs.append(v)
        v >>= 1
    m = len(gs)

    cnt = 0
    for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
    return [m, gs, cnt] def shell_sort(ary):
    ary_len = len(ary)
    gs = []
    v = ary_len
    while v > 0:
        gs.append(v)
        v >>= 1
    m = len(gs)

    cnt = 0
    for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
    return [m, gs, cnt] shell_sort lines = sys.stdin.readlines() sys.stdin.readlines() lines ary_len = int(lines.pop(0)) int(lines.pop(0)) ary_len gs, cnt = shell_sort(ary) shell_sort(ary) gs
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
# Shell Sort
# Result:
import sys
import math

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

def shell_sort(ary):
    ary_len = len(ary)
    gs = []
    v = ary_len
    while v > 0:
        gs.append(v)
        v >>= 1
    m = len(gs)

    cnt = 0
    for i in range(0, m):
        cnt += insertion_sort(ary, gs[i])
    return [m, gs, cnt]

lines = sys.stdin.readlines()
ary_len = int(lines.pop(0))
ary = map(int, lines)
assert ary_len == len(ary)

m, gs, cnt = shell_sort(ary)
print m
print ' '.join(map(str, gs))
print cnt
for v in ary:
    print v