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


def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g


n = int(input())
A = list()
m = list()
count = 0

for k in range(n):
    A.append(int(input()))

m = shell()

print(len(m))

m_list = [str(m[k]) for k in reversed(range(len(m)))]
print(' '.join(m_list))

for k in reversed(m):
    count += insertion(k)

print(count)

for k in range(len(A)):
    print(A[k])
 def insertion(mi):
    cnt = 0
    for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
    return cnt insertion cnt = 0 cnt 0 for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
     i range(mi, n) range mi n v = A[i] v A[i] A i j = i - mi j i - mi i mi while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j+mi] = A[j] A[j+mi] A j+mi j mi A[j] A j j -= mi j mi cnt += 1 cnt 1 A[j+mi] = v A[j+mi] A j+mi j mi v return cnt cnt mi mi def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g shell g = list() g list() list h = 1 h 1 if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

     n == 1 n 1 g.append(h) g.append g append h while h < len(A):
            g.append(h)
            h = 3 * h + 1

     h < len(A) h len(A) len A g.append(h) g.append g append h h = 3 * h + 1 h 3 * h + 1 3 * h 3 h 1 return g g n = int(input()) n int(input()) int input() input A = list() A list() list m = list() m list() list count = 0 count 0 for k in range(n):
    A.append(int(input())) k range(n) range n A.append(int(input())) A.append A append int(input()) int input() input m = shell() m shell() shell print(len(m)) print len(m) len m str(m[k]) for k in reversed(range(len(m))) for k in reversed(range(len(m))) k reversed(range(len(m))) reversed range(len(m)) range len(m) len m for k in reversed(range(len(m))) str(m[k]) str m[k] m k m_list = [str(m[k]) for k in reversed(range(len(m)))] m_list [str(m[k]) for k in reversed(range(len(m)))] print(' '.join(m_list)) print ' '.join(m_list) ' '.join ' ' join m_list for k in reversed(m):
    count += insertion(k) k reversed(m) reversed m count += insertion(k) count insertion(k) insertion k print(count) print count for k in range(len(A)):
    print(A[k]) k range(len(A)) range len(A) len A print(A[k]) print A[k] A k A = list() list() A def insertion(mi):
    cnt = 0
    for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
    return cnt def insertion(mi):
    cnt = 0
    for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
    return cnt insertion def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g shell m_list = [str(m[k]) for k in reversed(range(len(m)))] [str(m[k]) for k in reversed(range(len(m)))] m_list count += insertion(k) insertion(k) count n = int(input()) int(input()) n m = shell() shell() m m = list() list() m count = 0 0 count
def insertion(mi):
    cnt = 0
    for i in range(mi, n):
        v = A[i]
        j = i - mi
        while j >= 0 and A[j] > v:
            A[j+mi] = A[j]
            j -= mi
            cnt += 1
        A[j+mi] = v
    return cnt


def shell():
    g = list()
    h = 1

    if n == 1:
        g.append(h)
    else:
        while h < len(A):
            g.append(h)
            h = 3 * h + 1

    return g


n = int(input())
A = list()
m = list()
count = 0

for k in range(n):
    A.append(int(input()))

m = shell()

print(len(m))

m_list = [str(m[k]) for k in reversed(range(len(m)))]
print(' '.join(m_list))

for k in reversed(m):
    count += insertion(k)

print(count)

for k in range(len(A)):
    print(A[k])

