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(input())
a = list(int(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 insertion_sort 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
     i range(g, n) range g n v, j = a[i], i - g v a[i] a i j i - g i g while j >= 0 and a[j] > v:
            a[j + g] = a[j]
            j = j - g
            cnt += 1
         j >= 0 and a[j] > v j >= 0 j 0 a[j] > v a[j] a j v a[j + g] = a[j] a[j + g] a j + g j g a[j] a j j = j - g j j - g j g cnt += 1 cnt 1 a[j + g] = v a[j + g] a j + g j g v return cnt cnt a a n n g g cnt cnt n = int(input()) n int(input()) int input() input a = list(int(input()) for _ in range(n)) a list(int(input()) for _ in range(n)) list int(input()) int input() input m, g, glist, cnt = 0, 1, [], 0 m 0 g 1 glist [] cnt 0 while g <= n:
    m += 1
    glist.append(g)
    g = 4 ** m + 3 * 2 ** (m - 1) + 1 g <= n g n m += 1 m 1 glist.append(g) glist.append glist append g g = 4 ** m + 3 * 2 ** (m - 1) + 1 g 4 ** m + 3 * 2 ** (m - 1) + 1 4 ** m + 3 * 2 ** (m - 1) 4 ** m 4 m 3 * 2 ** (m - 1) 3 2 ** (m - 1) 2 m - 1 m 1 1 glist.reverse() glist.reverse glist reverse for g in glist:
    cnt = insertion_sort(a, n, g, cnt) g glist cnt = insertion_sort(a, n, g, cnt) cnt insertion_sort(a, n, g, cnt) insertion_sort a n g cnt print(m) print m print(*glist) print *glist glist print(cnt) print cnt print('\n'.join(map(str, a))) print '\n'.join(map(str, a)) '\n'.join '\n' join map(str, a) map str a g = 4 ** m + 3 * 2 ** (m - 1) + 1 4 ** m + 3 * 2 ** (m - 1) + 1 g m += 1 1 m cnt = 0, 1, [], 0 0 cnt m, g, glist, cnt = 0, 1, [], 0 0 m glist, cnt = 0, 1, [], 0 [] glist n = int(input()) int(input()) n 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 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 insertion_sort g, glist, cnt = 0, 1, [], 0 1 g a = list(int(input()) for _ in range(n)) list(int(input()) for _ in range(n)) a cnt = insertion_sort(a, n, g, cnt) insertion_sort(a, n, g, cnt) cnt
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(input())
a = list(int(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)))