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

def shellSort(A, n):
    cnt = 0
    G = [1]
    idx = 0
    for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
    G = list(reversed(G[:]))
    #print G
    m = len(G)
    print m
    print ' '.join(map(str,G))
    newA = A[:]
    for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
    return newA, cnt

def main():
    n = int(input())
    A = [int(input()) for i in xrange(n)]
    newA, cnt = shellSort(A, n)
    print cnt
    for i in range(len(newA)):
        print newA[i]
    return 0

if __name__ == '__main__':
    main() def insertionSort(A, n, g, cnt):
    for i in xrange(1,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return A, cnt insertionSort for i in xrange(1,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
     i xrange(1,n) xrange 1 n v = A[i] v A[i] A i j = i - g j i - g i g while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j+g] = A[j] A[j+g] A j+g j g A[j] A j j = j - g j j - g j g cnt += 1 cnt 1 A[j+g] = v A[j+g] A j+g j g v return A, cnt return A, cnt A cnt A A n n g g cnt cnt def shellSort(A, n):
    cnt = 0
    G = [1]
    idx = 0
    for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
    G = list(reversed(G[:]))
    #print G
    m = len(G)
    print m
    print ' '.join(map(str,G))
    newA = A[:]
    for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
    return newA, cnt shellSort cnt = 0 cnt 0 G = [1] G [1] 1 idx = 0 idx 0 for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
     i range(1,len(A)) range 1 len(A) len A if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
     3*G[idx]+1 < len(A) 3*G[idx]+1 3*G[idx] 3 G[idx] G idx 1 len(A) len A G.append(3*G[idx]+1) G.append G append 3*G[idx]+1 3*G[idx] 3 G[idx] G idx 1 idx += 1 idx 1 G = list(reversed(G[:])) G list(reversed(G[:])) list reversed(G[:]) reversed G[:] G : m = len(G) m len(G) len G print print ' '.join(map(str,G)) ' '.join ' ' join map(str,G) map str G newA = A[:] newA A[:] A : for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
     i range(0,m) range 0 m newA, cnt = insertionSort(newA[:],len(A),G[i],cnt) newA insertionSort(newA[:],len(A),G[i],cnt) insertionSort newA[:] newA : len(A) len A G[i] G i cnt cnt return newA, cnt return newA, cnt newA cnt A A n n def main():
    n = int(input())
    A = [int(input()) for i in xrange(n)]
    newA, cnt = shellSort(A, n)
    print cnt
    for i in range(len(newA)):
        print newA[i]
    return 0 main n = int(input()) n int(input()) int input() input int(input()) for i in xrange(n) for i in xrange(n) i xrange(n) xrange n for i in xrange(n) int(input()) int input() input A = [int(input()) for i in xrange(n)] A [int(input()) for i in xrange(n)] newA, cnt = shellSort(A, n) newA shellSort(A, n) shellSort A n cnt print for i in range(len(newA)):
        print newA[i]
     i range(len(newA)) range len(newA) len newA print newA[i] newA i return 0 0 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    A = [int(input()) for i in xrange(n)]
    newA, cnt = shellSort(A, n)
    print cnt
    for i in range(len(newA)):
        print newA[i]
    return 0 def main():
    n = int(input())
    A = [int(input()) for i in xrange(n)]
    newA, cnt = shellSort(A, n)
    print cnt
    for i in range(len(newA)):
        print newA[i]
    return 0 main def insertionSort(A, n, g, cnt):
    for i in xrange(1,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return A, cnt def insertionSort(A, n, g, cnt):
    for i in xrange(1,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return A, cnt insertionSort def shellSort(A, n):
    cnt = 0
    G = [1]
    idx = 0
    for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
    G = list(reversed(G[:]))
    #print G
    m = len(G)
    print m
    print ' '.join(map(str,G))
    newA = A[:]
    for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
    return newA, cnt def shellSort(A, n):
    cnt = 0
    G = [1]
    idx = 0
    for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
    G = list(reversed(G[:]))
    #print G
    m = len(G)
    print m
    print ' '.join(map(str,G))
    newA = A[:]
    for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
    return newA, cnt shellSort
def insertionSort(A, n, g, cnt):
    for i in xrange(1,n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return A, cnt

def shellSort(A, n):
    cnt = 0
    G = [1]
    idx = 0
    for i in range(1,len(A)):
        if 3*G[idx]+1 < len(A):
            G.append(3*G[idx]+1)
            idx += 1
    G = list(reversed(G[:]))
    #print G
    m = len(G)
    print m
    print ' '.join(map(str,G))
    newA = A[:]
    for i in range(0,m):
        newA, cnt = insertionSort(newA[:],len(A),G[i],cnt)
    return newA, cnt

def main():
    n = int(input())
    A = [int(input()) for i in xrange(n)]
    newA, cnt = shellSort(A, n)
    print cnt
    for i in range(len(newA)):
        print newA[i]
    return 0

if __name__ == '__main__':
    main()