def insertion_sort(a, n, g, cnt):

    for i in range(g, n):

        v, j = a[i], i - g

        while j >= 0 and a[j] > v:

            a[j + g] = a[j]

            j = j - g

            cnt += 1

        a[j + g] = v

    return cnt





n = int(eval(input()))

a = list(int(eval(input())) for _ in range(n))



m, g, cnt = 0, n // 2 + 1, 0

glist = []



while g:

    m += 1

    glist.append(g)

    cnt = insertion_sort(a, n, g, cnt)

    g //= 2



print(m)

print((*glist))

print(cnt)

print(('\n'.join(str(i) for i in a)))
def insertion_sort(a, n, g, cnt):

    for i in range(g, n):

        v, j = a[i], i - g

        while j >= 0 and a[j] > v:

            a[j + g] = a[j]

            j = j - g

            cnt += 1

        a[j + g] = v

    return cnt





n = int(eval(input()))

a = list(int(eval(input())) for _ in range(n))



m, g, glist, cnt = 0, 1, [], 0

while g <= n:

    m += 1

    glist.append(g)

    g = 4 ** m + 3 * 2 ** (m - 1) + 1



glist.reverse()



for g in glist:

    cnt = insertion_sort(a, n, g, cnt)



print(m)

print((*glist))

print(cnt)

print(('\n'.join(map(str, a))))
def insertion_sort(a, n, g, cnt):
    for i in range(g, n):
        v, j = a[i], i - g
        while j >= 0 and a[j] > v:
            a[j + g] = a[j]
            j = j - g
            cnt += 1
        a[j + g] = v
    return cnt


n = int(eval(input()))
a = list(int(eval(input())) for _ in range(n))
m, g, cnt = 0, n // 2 + 1, 0
glist = []
while g:
    m += 1
    glist.append(g)
    cnt = insertion_sort(a, n, g, cnt)
    g //= 2
print(m)
print((*glist))
print(cnt)
print(("\n".join(str(i) for i in a)))

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


n = int(eval(input()))
a = list(int(eval(input())) for _ in range(n))
m, g, glist, cnt = 0, 1, [], 0
while g <= n:
    m += 1
    glist.append(g)
    g = 4**m + 3 * 2 ** (m - 1) + 1
glist.reverse()
for g in glist:
    cnt = insertion_sort(a, n, g, cnt)
print(m)
print((*glist))
print(cnt)
print(("\n".join(map(str, a))))

-m, g, cnt = 0, n // 2 + 1, 0 -glist = [] -while g: +m, g, glist, cnt = 0, 1, [], 0 +while g <= n: +    g = 4**m + 3 * 2 ** (m - 1) + 1 +glist.reverse() +for g in glist: -    g //= 2 -print(("\n".join(str(i) for i in a))) +print(("\n".join(map(str, a))))