N = int(input())
A = [int(input()) for i in range(N)]

def insertion_sort(A, N, diff, cnt):
    for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
    return cnt

if __name__ == "__main__":
    cnt = 0
    divide_cnt = 0
    diffs = []
    if N == 1:
        diffs.append(1)
        divide_cnt += 1
    else:
        quotient = N
        while quotient != 1:
            quotient = quotient // 2
            diffs.append(quotient)
            divide_cnt += 1
    for diff in diffs:
        cnt = insertion_sort(A, N, diff, cnt)
    print(divide_cnt)
    print(" ".join(map(str, diffs)))
    print(cnt)
    for num in A:
        print(num)
 N = int(input()) N int(input()) int input() input int(input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(input()) int input() input A = [int(input()) for i in range(N)] A [int(input()) for i in range(N)] def insertion_sort(A, N, diff, cnt):
    for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
    return cnt insertion_sort for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
     i range(diff, N) range diff N tmp_num = A[i] tmp_num A[i] A i j = i - diff j i - diff i diff while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
         j >= 0 and A[j] > tmp_num j >= 0 j 0 A[j] > tmp_num A[j] A j tmp_num A[j+diff] = A[j] A[j+diff] A j+diff j diff A[j] A j j = j - diff j j - diff j diff cnt += 1 cnt 1 A[j+diff] = tmp_num A[j+diff] A j+diff j diff tmp_num return cnt cnt A A N N diff diff cnt cnt if __name__ == "__main__":
    cnt = 0
    divide_cnt = 0
    diffs = []
    if N == 1:
        diffs.append(1)
        divide_cnt += 1
    else:
        quotient = N
        while quotient != 1:
            quotient = quotient // 2
            diffs.append(quotient)
            divide_cnt += 1
    for diff in diffs:
        cnt = insertion_sort(A, N, diff, cnt)
    print(divide_cnt)
    print(" ".join(map(str, diffs)))
    print(cnt)
    for num in A:
        print(num) __name__ == "__main__" __name__ "__main__" cnt = 0 cnt 0 divide_cnt = 0 divide_cnt 0 diffs = [] diffs [] if N == 1:
        diffs.append(1)
        divide_cnt += 1
    else:
        quotient = N
        while quotient != 1:
            quotient = quotient // 2
            diffs.append(quotient)
            divide_cnt += 1
     N == 1 N 1 diffs.append(1) diffs.append diffs append 1 divide_cnt += 1 divide_cnt 1 quotient = N quotient N while quotient != 1:
            quotient = quotient // 2
            diffs.append(quotient)
            divide_cnt += 1
     quotient != 1 quotient 1 quotient = quotient // 2 quotient quotient // 2 quotient 2 diffs.append(quotient) diffs.append diffs append quotient divide_cnt += 1 divide_cnt 1 for diff in diffs:
        cnt = insertion_sort(A, N, diff, cnt)
     diff diffs cnt = insertion_sort(A, N, diff, cnt) cnt insertion_sort(A, N, diff, cnt) insertion_sort A N diff cnt print(divide_cnt) print divide_cnt print(" ".join(map(str, diffs))) print " ".join(map(str, diffs)) " ".join " " join map(str, diffs) map str diffs print(cnt) print cnt for num in A:
        print(num) num A print(num) print num cnt = 0 0 cnt cnt = insertion_sort(A, N, diff, cnt) insertion_sort(A, N, diff, cnt) cnt divide_cnt += 1 1 divide_cnt divide_cnt = 0 0 divide_cnt A = [int(input()) for i in range(N)] [int(input()) for i in range(N)] A N = int(input()) int(input()) N quotient = N N quotient quotient = quotient // 2 quotient // 2 quotient divide_cnt += 1 1 divide_cnt def insertion_sort(A, N, diff, cnt):
    for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
    return cnt def insertion_sort(A, N, diff, cnt):
    for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
    return cnt insertion_sort diffs = [] [] diffs
N = int(input())
A = [int(input()) for i in range(N)]

def insertion_sort(A, N, diff, cnt):
    for i in range(diff, N):
        tmp_num = A[i]
        j = i - diff
        while j >= 0 and A[j] > tmp_num:
            A[j+diff] = A[j]
            j = j - diff
            cnt += 1
        A[j+diff] = tmp_num
    return cnt

if __name__ == "__main__":
    cnt = 0
    divide_cnt = 0
    diffs = []
    if N == 1:
        diffs.append(1)
        divide_cnt += 1
    else:
        quotient = N
        while quotient != 1:
            quotient = quotient // 2
            diffs.append(quotient)
            divide_cnt += 1
    for diff in diffs:
        cnt = insertion_sort(A, N, diff, cnt)
    print(divide_cnt)
    print(" ".join(map(str, diffs)))
    print(cnt)
    for num in A:
        print(num)

