N = int(input())
a = [int(input()) for i in range(N)]
f = []
x = 1
while x <= N:
    f.append(x)
    x = 3*x + 1
cnt = 0
g = f[::-1]

def insertionSort(a, N, g):
    global cnt
    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 -= g
            cnt += 1
        a[j + g] = v
  
m = len(g)    
for j in range(m):
    insertionSort(a, N, g[j])

print(m)
print(" ".join(map(str, g)))
print(cnt)
for i in range(N):
    print(a[i]) 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)] f = [] f [] x = 1 x 1 while x <= N:
    f.append(x)
    x = 3*x + 1 x <= N x N f.append(x) f.append f append x x = 3*x + 1 x 3*x + 1 3*x 3 x 1 cnt = 0 cnt 0 g = f[::-1] g f[::-1] f ::-1 -1 def insertionSort(a, N, g):
    global cnt
    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 -= g
            cnt += 1
        a[j + g] = v
   insertionSort global cnt 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 -= g
            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 -= 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 -= g j g cnt += 1 cnt 1 a[j + g] = v a[j + g] a j + g j g v a a N N g g m = len(g) m len(g) len g for j in range(m):
    insertionSort(a, N, g[j]) j range(m) range m insertionSort(a, N, g[j]) insertionSort a N g[j] g j print(m) print m print(" ".join(map(str, g))) print " ".join(map(str, g)) " ".join " " join map(str, g) map str g print(cnt) print cnt for i in range(N):
    print(a[i]) i range(N) range N print(a[i]) print a[i] a i m = len(g) len(g) m g = f[::-1] f[::-1] g def insertionSort(a, N, g):
    global cnt
    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 -= g
            cnt += 1
        a[j + g] = v
   def insertionSort(a, N, g):
    global cnt
    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 -= g
            cnt += 1
        a[j + g] = v
   insertionSort N = int(input()) int(input()) N x = 1 1 x x = 3*x + 1 3*x + 1 x cnt = 0 0 cnt a = [int(input()) for i in range(N)] [int(input()) for i in range(N)] a f = [] [] f
N = int(input())
a = [int(input()) for i in range(N)]
f = []
x = 1
while x <= N:
    f.append(x)
    x = 3*x + 1
cnt = 0
g = f[::-1]

def insertionSort(a, N, g):
    global cnt
    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 -= g
            cnt += 1
        a[j + g] = v
  
m = len(g)    
for j in range(m):
    insertionSort(a, N, g[j])

print(m)
print(" ".join(map(str, g)))
print(cnt)
for i in range(N):
    print(a[i])