#shellSort(A, n)
n=int(input())
A=[int(input()) for i in range(n)]
cnt = 0
G=[1]
S=str(G[0])
#if 5<n<13:
t=n//5
#elif n<3000:
  #  t=n//9
#else:
  #  t=n//17
#Gt=[4, 9, 20, 46, 103, 233, 525, 1182,2660, 5985, 13467]
f=1.0
while f<t:
    f*=2.2
    f=int(f)
    G.insert(0,f)
  #  print (i)
    S=str(G[0])+" "+S
m=len(G)
print (m)
print(S)
for i in range(m):
    g=G[i]
    for j in range(g,n):
        v = A[j]
        k = j - g
        while k >= 0 and A[k] > v:
              A[k+g] = A[k]
              k = k - g
              cnt+=1
        A[k+g] = v 
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)] cnt = 0 cnt 0 G=[1] G [1] 1 S=str(G[0]) S str(G[0]) str G[0] G 0 t=n//5 t n//5 n 5 f=1.0 f 1.0 while f<t:
    f*=2.2
    f=int(f)
    G.insert(0,f)
  #  print (i)
    S=str(G[0])+" "+S f<t f t f*=2.2 f 2.2 f=int(f) f int(f) int f G.insert(0,f) G.insert G insert 0 f S=str(G[0])+" "+S S str(G[0])+" "+S str(G[0])+" " str(G[0]) str G[0] G 0 " " S m=len(G) m len(G) len G print (m) print m print(S) print S for i in range(m):
    g=G[i]
    for j in range(g,n):
        v = A[j]
        k = j - g
        while k >= 0 and A[k] > v:
              A[k+g] = A[k]
              k = k - g
              cnt+=1
        A[k+g] = v  i range(m) range m g=G[i] g G[i] G i for j in range(g,n):
        v = A[j]
        k = j - g
        while k >= 0 and A[k] > v:
              A[k+g] = A[k]
              k = k - g
              cnt+=1
        A[k+g] = v  j range(g,n) range g n v = A[j] v A[j] A j k = j - g k j - g j g while k >= 0 and A[k] > v:
              A[k+g] = A[k]
              k = k - g
              cnt+=1
         k >= 0 and A[k] > v k >= 0 k 0 A[k] > v A[k] A k v A[k+g] = A[k] A[k+g] A k+g k g A[k] A k k = k - g k k - g k g cnt+=1 cnt 1 A[k+g] = v A[k+g] A k+g k g v 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 v = A[j] A[j] v n=int(input()) int(input()) n m=len(G) len(G) m f=int(f) int(f) f t=n//5 n//5 t S=str(G[0]) str(G[0]) S k = j - g j - g k cnt+=1 1 cnt cnt = 0 0 cnt g=G[i] G[i] g f*=2.2 2.2 f k = k - g k - g k A=[int(input()) for i in range(n)] [int(input()) for i in range(n)] A S=str(G[0])+" "+S str(G[0])+" "+S S G=[1] [1] G f=1.0 1.0 f
#shellSort(A, n)
n=int(input())
A=[int(input()) for i in range(n)]
cnt = 0
G=[1]
S=str(G[0])
#if 5<n<13:
t=n//5
#elif n<3000:
  #  t=n//9
#else:
  #  t=n//17
#Gt=[4, 9, 20, 46, 103, 233, 525, 1182,2660, 5985, 13467]
f=1.0
while f<t:
    f*=2.2
    f=int(f)
    G.insert(0,f)
  #  print (i)
    S=str(G[0])+" "+S
m=len(G)
print (m)
print(S)
for i in range(m):
    g=G[i]
    for j in range(g,n):
        v = A[j]
        k = j - g
        while k >= 0 and A[k] > v:
              A[k+g] = A[k]
              k = k - g
              cnt+=1
        A[k+g] = v 
print(cnt)
for i in range(n):
    print(A[i])