def insertionSortForShell(lst, n, g):
    cnt = 0
    for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
    return cnt


def cleate_split_lst(n):
    lst = []
    while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
    return lst


def shellSort(lst, n):
    cnt = 0
    G = cleate_split_lst(n)

    for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

    print(len(G))
    print(" ".join([str(g) for g in G]))
    print(cnt)
    for n in lst:
        print(n)


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(0, n):
        lst.append(int(input()))
    shellSort(lst, n) def insertionSortForShell(lst, n, g):
    cnt = 0
    for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
    return cnt insertionSortForShell cnt = 0 cnt 0 for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
     i range(g, n) range g n v = lst[i] v lst[i] lst i j = i - g j i - g i g while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
         j >= 0 and lst[j] > v j >= 0 j 0 lst[j] > v lst[j] lst j v lst[j+g] = lst[j] lst[j+g] lst j+g j g lst[j] lst j j = j - g j j - g j g cnt += 1 cnt 1 lst[j+g] = v lst[j+g] lst j+g j g v return cnt cnt lst lst n n g g def cleate_split_lst(n):
    lst = []
    while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
    return lst cleate_split_lst lst = [] lst [] while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
     1 n = int(n/2) n int(n/2) int n/2 n 2 if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
     n <= 1 n 1 lst.append(1) lst.append lst append 1 break lst.append(n) lst.append lst append n return lst lst n n def shellSort(lst, n):
    cnt = 0
    G = cleate_split_lst(n)

    for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

    print(len(G))
    print(" ".join([str(g) for g in G]))
    print(cnt)
    for n in lst:
        print(n) shellSort cnt = 0 cnt 0 G = cleate_split_lst(n) G cleate_split_lst(n) cleate_split_lst n for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

     i range(0, len(G)) range 0 len(G) len G cnt += insertionSortForShell(lst, n, G[i]) cnt insertionSortForShell(lst, n, G[i]) insertionSortForShell lst n G[i] G i print(len(G)) print len(G) len G str(g) for g in G for g in G g G for g in G str(g) str g print(" ".join([str(g) for g in G])) print " ".join([str(g) for g in G]) " ".join " " join [str(g) for g in G] print(cnt) print cnt for n in lst:
        print(n) n lst print(n) print n lst lst n n if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(0, n):
        lst.append(int(input()))
    shellSort(lst, n) __name__ == "__main__" __name__ "__main__" n = int(input()) n int(input()) int input() input lst = [] lst [] for i in range(0, n):
        lst.append(int(input()))
     i range(0, n) range 0 n lst.append(int(input())) lst.append lst append int(input()) int input() input shellSort(lst, n) shellSort lst n def cleate_split_lst(n):
    lst = []
    while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
    return lst def cleate_split_lst(n):
    lst = []
    while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
    return lst cleate_split_lst def shellSort(lst, n):
    cnt = 0
    G = cleate_split_lst(n)

    for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

    print(len(G))
    print(" ".join([str(g) for g in G]))
    print(cnt)
    for n in lst:
        print(n) def shellSort(lst, n):
    cnt = 0
    G = cleate_split_lst(n)

    for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

    print(len(G))
    print(" ".join([str(g) for g in G]))
    print(cnt)
    for n in lst:
        print(n) shellSort n = int(input()) int(input()) n lst = [] [] lst def insertionSortForShell(lst, n, g):
    cnt = 0
    for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
    return cnt def insertionSortForShell(lst, n, g):
    cnt = 0
    for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
    return cnt insertionSortForShell
def insertionSortForShell(lst, n, g):
    cnt = 0
    for i in range(g, n):
        v = lst[i]
        j = i - g
        while j >= 0 and lst[j] > v:
            lst[j+g] = lst[j]
            j = j - g
            cnt += 1
        lst[j+g] = v
    return cnt


def cleate_split_lst(n):
    lst = []
    while 1:
        n = int(n/2)
        if n <= 1:
                lst.append(1)
                break
        else:
                lst.append(n)
    return lst


def shellSort(lst, n):
    cnt = 0
    G = cleate_split_lst(n)

    for i in range(0, len(G)):
        cnt += insertionSortForShell(lst, n, G[i])

    print(len(G))
    print(" ".join([str(g) for g in G]))
    print(cnt)
    for n in lst:
        print(n)


if __name__ == "__main__":
    n = int(input())
    lst = []
    for i in range(0, n):
        lst.append(int(input()))
    shellSort(lst, n)