n = int(input())
A = list()
for i in range(0, n):
    A.append(int(input()))

G = [1]  # G[0]????????¨?????????
cnt = 0

# G[i] = 3*Gi-1 + 1
for i in range(1, 100):
    h = 4**i + 3*2**(i-1) + 1
    if(h > n):  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.append(h)


for g in reversed(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
            cnt += 1
        A[j+g] = v


print(m)
print(" ".join(str(x) for x in reversed(G)))
print(cnt)

print("\n".join(str(x) for x in A)) n = int(input()) n int(input()) int input() input A = list() A list() list for i in range(0, n):
    A.append(int(input())) i range(0, n) range 0 n A.append(int(input())) A.append A append int(input()) int input() input G = [1] G [1] 1 cnt = 0 cnt 0 for i in range(1, 100):
    h = 4**i + 3*2**(i-1) + 1
    if(h > n):  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.append(h) i range(1, 100) range 1 100 h = 4**i + 3*2**(i-1) + 1 h 4**i + 3*2**(i-1) + 1 4**i + 3*2**(i-1) 4**i 4 i 3*2**(i-1) 3 2**(i-1) 2 i-1 i 1 1 if(h > n):  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.append(h) h > n h n m = i m i break G.append(h) G.append G append h for g in reversed(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
            cnt += 1
        A[j+g] = v g reversed(G) reversed 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
            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
            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 print(m) print m print(" ".join(str(x) for x in reversed(G))) print " ".join(str(x) for x in reversed(G)) " ".join " " join str(x) str x print(cnt) print cnt print("\n".join(str(x) for x in A)) print "\n".join(str(x) for x in A) "\n".join "\n" join str(x) str x cnt = 0 0 cnt h = 4**i + 3*2**(i-1) + 1 4**i + 3*2**(i-1) + 1 h j = i - g i - g j G = [1] [1] G j = j - g j - g j A = list() list() A n = int(input()) int(input()) n m = i i m v = A[i] A[i] v cnt += 1 1 cnt
n = int(input())
A = list()
for i in range(0, n):
    A.append(int(input()))

G = [1]  # G[0]????????¨?????????
cnt = 0

# G[i] = 3*Gi-1 + 1
for i in range(1, 100):
    h = 4**i + 3*2**(i-1) + 1
    if(h > n):  # h???n?¶???????????????§?????????4n+3*2n-1+1
        m = i
        break
    else:
        G.append(h)


for g in reversed(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
            cnt += 1
        A[j+g] = v


print(m)
print(" ".join(str(x) for x in reversed(G)))
print(cnt)

print("\n".join(str(x) for x in A))