class solve:
    def __init__(self, n):
        pass

    def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

    def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g)


n, *A = map(int, open(0).read().split())
solver = solve(n)
solver.shellsort(A, n)
print(solver.m)
print(' '.join(map(str, solver.G)))
print(solver.cnt)
print('\n'.join(map(str, A))) class solve:
    def __init__(self, n):
        pass

    def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

    def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g) solve def __init__(self, n):
        pass

     __init__ self self n n def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

     insertionsort for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

     i range(g, n) range g 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
                self.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 self.cnt += 1 self.cnt self cnt 1 A[j + g] = v A[j + g] A j + g j g v self self A A n n g g def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g) shellsort self.cnt = 0 self.cnt self cnt 0 self.G = [1] self.G self G [1] 1 f = 1 f 1 while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
         f * 3 + 1 <= n f * 3 + 1 f * 3 f 3 1 n f = f * 3 + 1 f f * 3 + 1 f * 3 f 3 1 self.G.append(f) self.G.append self.G self G append f self.G = list(reversed(self.G)) self.G self G list(reversed(self.G)) list reversed(self.G) reversed self.G self G self.m = len(self.G) self.m self m len(self.G) len self.G self G for g in self.G:
            self.insertionsort(A, n, g) g self.G self G self.insertionsort(A, n, g) self.insertionsort self insertionsort A n g self self A A n n n, *A = map(int, open(0).read().split()) n map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *A A solver = solve(n) solver solve(n) solve n solver.shellsort(A, n) solver.shellsort solver shellsort A n print(solver.m) print solver.m solver m print(' '.join(map(str, solver.G))) print ' '.join(map(str, solver.G)) ' '.join ' ' join map(str, solver.G) map str solver.G solver G print(solver.cnt) print solver.cnt solver cnt print('\n'.join(map(str, A))) print '\n'.join(map(str, A)) '\n'.join '\n' join map(str, A) map str A class solve:
    def __init__(self, n):
        pass

    def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

    def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g) class solve:
    def __init__(self, n):
        pass

    def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

    def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g) solve n, *A = map(int, open(0).read().split()) map(int, open(0).read().split()) n solver = solve(n) solve(n) solver
class solve:
    def __init__(self, n):
        pass

    def insertionsort(self, A, n, g):
        for i in range(g, n):
            v = A[i]
            j = i - g
            while j >= 0 and A[j] > v:
                A[j + g] = A[j]
                j = j - g
                self.cnt += 1
            A[j + g] = v

    def shellsort(self, A, n):
        self.cnt = 0
        self.G = [1]
        f = 1
        while f * 3 + 1 <= n:
            f = f * 3 + 1
            self.G.append(f)
        self.G = list(reversed(self.G))
        self.m = len(self.G)
        for g in self.G:
            self.insertionsort(A, n, g)


n, *A = map(int, open(0).read().split())
solver = solve(n)
solver.shellsort(A, n)
print(solver.m)
print(' '.join(map(str, solver.G)))
print(solver.cnt)
print('\n'.join(map(str, A)))
