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