cnt = 0

def insert_sort(g):

    global cnt

    i = g

    for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break


def shell_sort():

    i = 0

    for _ in range(m):

        insert_sort(g[i])

        i += 1

n = int(input())

nums = []

for _ in range(n):

    nums.append(int(input()))

g = []

g_val = n

for _ in range(n):

    g_val = g_val // 2

    g.append(g_val)

    if g_val == 1:

        break

m = len(g)

shell_sort()

print(m)

g_cnt = 0

s = ''

for _ in range(m):

    s += str(g[g_cnt]) + ' '

    g_cnt += 1

print(s.rstrip())

print(cnt)

nums_cnt = 0

for _ in range(n):

    print(nums[nums_cnt])

    nums_cnt += 1
 cnt = 0 cnt 0 def insert_sort(g):

    global cnt

    i = g

    for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break insert_sort global cnt i = g i g for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break _ range(n) range n v = nums[i] v nums[i] nums i j = i - g j i - g i g while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
         j >= 0 and nums[j] > v j >= 0 j 0 nums[j] > v nums[j] nums j v nums[j + g] = nums[j] nums[j + g] nums j + g j g nums[j] nums j j -= g j g cnt += 1 cnt 1 nums[j + g] = v nums[j + g] nums j + g j g v i += 1 i 1 if i >= n:

            break i >= n i n break g g def shell_sort():

    i = 0

    for _ in range(m):

        insert_sort(g[i])

        i += 1 shell_sort i = 0 i 0 for _ in range(m):

        insert_sort(g[i])

        i += 1 _ range(m) range m insert_sort(g[i]) insert_sort g[i] g i i += 1 i 1 n = int(input()) n int(input()) int input() input nums = [] nums [] for _ in range(n):

    nums.append(int(input())) _ range(n) range n nums.append(int(input())) nums.append nums append int(input()) int input() input g = [] g [] g_val = n g_val n for _ in range(n):

    g_val = g_val // 2

    g.append(g_val)

    if g_val == 1:

        break _ range(n) range n g_val = g_val // 2 g_val g_val // 2 g_val 2 g.append(g_val) g.append g append g_val if g_val == 1:

        break g_val == 1 g_val 1 break m = len(g) m len(g) len g shell_sort() shell_sort print(m) print m g_cnt = 0 g_cnt 0 s = '' s '' for _ in range(m):

    s += str(g[g_cnt]) + ' '

    g_cnt += 1 _ range(m) range m s += str(g[g_cnt]) + ' ' s str(g[g_cnt]) + ' ' str(g[g_cnt]) str g[g_cnt] g g_cnt ' ' g_cnt += 1 g_cnt 1 print(s.rstrip()) print s.rstrip() s.rstrip s rstrip print(cnt) print cnt nums_cnt = 0 nums_cnt 0 for _ in range(n):

    print(nums[nums_cnt])

    nums_cnt += 1 _ range(n) range n print(nums[nums_cnt]) print nums[nums_cnt] nums nums_cnt nums_cnt += 1 nums_cnt 1 g_cnt = 0 0 g_cnt s += str(g[g_cnt]) + ' ' str(g[g_cnt]) + ' ' s nums_cnt = 0 0 nums_cnt g_cnt += 1 1 g_cnt n = int(input()) int(input()) n g = [] [] g m = len(g) len(g) m s = '' '' s nums = [] [] nums def shell_sort():

    i = 0

    for _ in range(m):

        insert_sort(g[i])

        i += 1 def shell_sort():

    i = 0

    for _ in range(m):

        insert_sort(g[i])

        i += 1 shell_sort g_val = n n g_val nums_cnt += 1 1 nums_cnt cnt = 0 0 cnt g_val = g_val // 2 g_val // 2 g_val def insert_sort(g):

    global cnt

    i = g

    for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break def insert_sort(g):

    global cnt

    i = g

    for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break insert_sort
cnt = 0

def insert_sort(g):

    global cnt

    i = g

    for _ in range(n):
        
        v = nums[i]

        j = i - g

        while j >= 0 and nums[j] > v:

            nums[j + g] = nums[j]
            
            j -= g

            cnt += 1
        
        nums[j + g] = v

        i += 1

        if i >= n:

            break


def shell_sort():

    i = 0

    for _ in range(m):

        insert_sort(g[i])

        i += 1

n = int(input())

nums = []

for _ in range(n):

    nums.append(int(input()))

g = []

g_val = n

for _ in range(n):

    g_val = g_val // 2

    g.append(g_val)

    if g_val == 1:

        break

m = len(g)

shell_sort()

print(m)

g_cnt = 0

s = ''

for _ in range(m):

    s += str(g[g_cnt]) + ' '

    g_cnt += 1

print(s.rstrip())

print(cnt)

nums_cnt = 0

for _ in range(n):

    print(nums[nums_cnt])

    nums_cnt += 1

