def insertionSort(arr,step):
    count = 0
    for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
    return count
 
def shellSort(arr):
    gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
    m = 0
    count = 0
    for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
    print(m)
    print(" ".join(map(str, gaps[len(gaps)-m:])))
    print(count)
    for num in arr:
        print(num)
 
arr = list()
for _ in range(int(input())):
    arr.append(int(input()))
shellSort(arr) def insertionSort(arr,step):
    count = 0
    for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
    return count
  insertionSort count = 0 count 0 for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
     i range(step, len(arr)) range step len(arr) len arr j = i j i while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
     j >= step and arr[j] < arr[j-step] j >= step j step arr[j] < arr[j-step] arr[j] arr j arr[j-step] arr j-step j step count += 1 count 1 t = arr[j] t arr[j] arr j arr[j] = arr[j-step] arr[j] arr j arr[j-step] arr j-step j step arr[j-step] = t arr[j-step] arr j-step j step t j -= step j step return count count arr arr step step def shellSort(arr):
    gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
    m = 0
    count = 0
    for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
    print(m)
    print(" ".join(map(str, gaps[len(gaps)-m:])))
    print(count)
    for num in arr:
        print(num)
  shellSort gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1] gaps [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1] 776591 345152 153401 68178 30301 13467 5985 2660 1182 525 233 103 46 20 9 4 1 m = 0 m 0 count = 0 count 0 for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
     step gaps if step > len(arr):
            continue
         step > len(arr) step len(arr) len arr continue m += 1 m 1 count += insertionSort(arr, step) count insertionSort(arr, step) insertionSort arr step print(m) print m print(" ".join(map(str, gaps[len(gaps)-m:]))) print " ".join(map(str, gaps[len(gaps)-m:])) " ".join " " join map(str, gaps[len(gaps)-m:]) map str gaps[len(gaps)-m:] gaps len(gaps)-m: len(gaps)-m len(gaps) len gaps m print(count) print count for num in arr:
        print(num)
  num arr print(num) print num arr arr arr = list() arr list() list for _ in range(int(input())):
    arr.append(int(input())) _ range(int(input())) range int(input()) int input() input arr.append(int(input())) arr.append arr append int(input()) int input() input shellSort(arr) shellSort arr def shellSort(arr):
    gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
    m = 0
    count = 0
    for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
    print(m)
    print(" ".join(map(str, gaps[len(gaps)-m:])))
    print(count)
    for num in arr:
        print(num)
  def shellSort(arr):
    gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
    m = 0
    count = 0
    for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
    print(m)
    print(" ".join(map(str, gaps[len(gaps)-m:])))
    print(count)
    for num in arr:
        print(num)
  shellSort arr = list() list() arr def insertionSort(arr,step):
    count = 0
    for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
    return count
  def insertionSort(arr,step):
    count = 0
    for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
    return count
  insertionSort
def insertionSort(arr,step):
    count = 0
    for i in range(step, len(arr)):
        j = i
        while j >= step and arr[j] < arr[j-step]:
            count += 1
            t = arr[j]
            arr[j] = arr[j-step]
            arr[j-step] = t
            j -= step
    return count
 
def shellSort(arr):
    gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
    m = 0
    count = 0
    for step in gaps:
        if step > len(arr):
            continue
        m += 1
        count += insertionSort(arr, step)
    print(m)
    print(" ".join(map(str, gaps[len(gaps)-m:])))
    print(count)
    for num in arr:
        print(num)
 
arr = list()
for _ in range(int(input())):
    arr.append(int(input()))
shellSort(arr)
