cnt = 0
coefficients = [1]
n = 1

_list = []
length = int(input())
for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue


for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*2.25 + 1

for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val

print(len(coefficients))
print(*coefficients[::-1])
print(cnt)
print(*_list, sep='\n') cnt = 0 cnt 0 coefficients = [1] coefficients [1] 1 n = 1 n 1 _list = [] _list [] length = int(input()) length int(input()) int input() input for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue i range(length) range length try:
        _list.append(int(input()))
    except EOFError:
        continue except EOFError:
        continue continue _list.append(int(input())) _list.append _list append int(input()) int input() input for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*2.25 + 1 i range(1,length) range 1 length if i < n:
        continue
     i < n i n continue coefficients.append(i) coefficients.append coefficients append i n = i*2.25 + 1 n i*2.25 + 1 i*2.25 i 2.25 1 for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val c coefficients[::-1] coefficients ::-1 -1 for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val i range(length) range length val = _list[i] val _list[i] _list i j = i - c j i - c i c while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
         j >= 0 and _list[j] > val j >= 0 j 0 _list[j] > val _list[j] _list j val _list[j + c] = _list[j] _list[j + c] _list j + c j c _list[j] _list j j -= c j c cnt += 1 cnt 1 _list[j+c] = val _list[j+c] _list j+c j c val print(len(coefficients)) print len(coefficients) len coefficients print(*coefficients[::-1]) print *coefficients[::-1] coefficients[::-1] coefficients ::-1 -1 print(cnt) print cnt print(*_list, sep='\n') print *_list _list sep='\n' sep '\n' n = 1 1 n j -= c c j cnt += 1 1 cnt coefficients = [1] [1] coefficients val = _list[i] _list[i] val cnt = 0 0 cnt j = i - c i - c j _list = [] [] _list length = int(input()) int(input()) length n = i*2.25 + 1 i*2.25 + 1 n
cnt = 0
coefficients = [1]
n = 1

_list = []
length = int(input())
for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue


for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*2.25 + 1

for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val

print(len(coefficients))
print(*coefficients[::-1])
print(cnt)
print(*_list, sep='\n')