import math
length = int(input())
targ = []
cnt = 0
mcnt = 1
for l in range(length):
    targ.append(int(input()))
m = 1
mlist = [1]
while True:
    m = math.ceil(2.25 * m + 1)
    if length <= m:
        break
    mcnt += 1
    mlist.append(m)
print(mcnt)
print(' '.join([str(n) for n in reversed(mlist)]))
mlength = mcnt - 1
while mlength >= 0:
    m = mlist[mlength]
    divided = length // m
    for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
    mlength -= 1
print(cnt)
for l in range(length):
    print(targ[l]) import math math length = int(input()) length int(input()) int input() input targ = [] targ [] cnt = 0 cnt 0 mcnt = 1 mcnt 1 for l in range(length):
    targ.append(int(input())) l range(length) range length targ.append(int(input())) targ.append targ append int(input()) int input() input m = 1 m 1 mlist = [1] mlist [1] 1 while True:
    m = math.ceil(2.25 * m + 1)
    if length <= m:
        break
    mcnt += 1
    mlist.append(m) True m = math.ceil(2.25 * m + 1) m math.ceil(2.25 * m + 1) math.ceil math ceil 2.25 * m + 1 2.25 * m 2.25 m 1 if length <= m:
        break
     length <= m length m break mcnt += 1 mcnt 1 mlist.append(m) mlist.append mlist append m print(mcnt) print mcnt str(n) for n in reversed(mlist) for n in reversed(mlist) n reversed(mlist) reversed mlist for n in reversed(mlist) str(n) str n print(' '.join([str(n) for n in reversed(mlist)])) print ' '.join([str(n) for n in reversed(mlist)]) ' '.join ' ' join [str(n) for n in reversed(mlist)] mlength = mcnt - 1 mlength mcnt - 1 mcnt 1 while mlength >= 0:
    m = mlist[mlength]
    divided = length // m
    for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
    mlength -= 1 mlength >= 0 mlength 0 m = mlist[mlength] m mlist[mlength] mlist mlength divided = length // m divided length // m length m for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
     inh range(m,length) range m length inlength = inh - m inlength inh - m inh m temp = targ[inh] temp targ[inh] targ inh while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
         inlength >= 0 and temp < targ[inlength] inlength >= 0 inlength 0 temp < targ[inlength] temp targ[inlength] targ inlength targ[inlength + m] = targ[inlength] targ[inlength + m] targ inlength + m inlength m targ[inlength] targ inlength cnt += 1 cnt 1 inlength -= m inlength m targ[inlength + m] = temp targ[inlength + m] targ inlength + m inlength m temp mlength -= 1 mlength 1 print(cnt) print cnt for l in range(length):
    print(targ[l]) l range(length) range length print(targ[l]) print targ[l] targ l cnt = 0 0 cnt m = mlist[mlength] mlist[mlength] m divided = length // m length // m divided mlength -= 1 1 mlength mlist = [1] [1] mlist mlength = mcnt - 1 mcnt - 1 mlength m = math.ceil(2.25 * m + 1) math.ceil(2.25 * m + 1) m targ = [] [] targ temp = targ[inh] targ[inh] temp cnt += 1 1 cnt m = 1 1 m mcnt += 1 1 mcnt mcnt = 1 1 mcnt inlength -= m m inlength length = int(input()) int(input()) length inlength = inh - m inh - m inlength
import math
length = int(input())
targ = []
cnt = 0
mcnt = 1
for l in range(length):
    targ.append(int(input()))
m = 1
mlist = [1]
while True:
    m = math.ceil(2.25 * m + 1)
    if length <= m:
        break
    mcnt += 1
    mlist.append(m)
print(mcnt)
print(' '.join([str(n) for n in reversed(mlist)]))
mlength = mcnt - 1
while mlength >= 0:
    m = mlist[mlength]
    divided = length // m
    for inh in range(m,length):
        inlength = inh - m
        temp = targ[inh]
        while inlength >= 0 and temp < targ[inlength]:
            targ[inlength + m] = targ[inlength]
            cnt += 1
            inlength -= m
        targ[inlength + m] = temp
    mlength -= 1
print(cnt)
for l in range(length):
    print(targ[l])