Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def insertion_sort(datan,n,g):
    cnt = 0
    for i in range(g,n):
        v = data[i]
        j = i - g
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j = j - g
            cnt += 1
        data[j+g] = v
    return cnt
def shellsort(data,n):
    cnt = 0
    m = 2
    G = [4,1]
    for i in range(m):
        cnt = insertion_sort(data,n,G[i])
        cnt += 1
    print(m)
    print(*G)
    print(cnt)
    for i in range(n):
        print(data[i])
shellsort(a,n)


Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def shell_sort(array):
    n = len(array)
    h = 0
    k = 0
    cnt = 0
    g = []
    while h <= n/9:
        h = 3*h + 1
        g.append = h
    while g[k] > 0:
        for i in range(h,n):
            tmp = array[i]
            if tmp < array[i-g[k]]:
                j = i
                while True:
                    array[j] = array[j-g[k]]
                    j -= h
                    c += 1
                    if j < h or tmp >= array[j-g[k]]:
                        break
                array[j] = tmp
    print(len(g))
    print(*g)
    for i in range(array): print(array[i])

d = []
for i in range(int(input())):
    d.append = int(input())
shell_sort(d)
    


Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def shell_sort(array):
    n = len(array)
    h = 0
    k = 0
    cnt = 0
    g = []
    while h <= n/9:
        h = 3*h + 1
        g.append = h
    while g[k] > 0:
        for i in range(h,n):
            tmp = array[i]
            if tmp < array[i-g[k]]:
                j = i
                while True:
                    array[j] = array[j-g[k]]
                    j -= h
                    c += 1
                    if j < h or tmp >= array[j-g[k]]:
                        break
                array[j] = tmp
    print(len(g))
    print(*g)
    for i in range(array): print(array[i])

d = []
for i in range(int(input())):
    d.append(int(input()))
shell_sort(d)
    


Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def shell_sort(array):
    n = len(array)
    h = 0
    k = 0
    cnt = 0
    g = []
    while h <= n/9:
        h = 3*h + 1
        g.append(h)
    while g[k] > 0:
        for i in range(h,n):
            tmp = array[i]
            if tmp < array[i-g[k]]:
                j = i
                while True:
                    array[j] = array[j-g[k]]
                    j -= h
                    c += 1
                    if j < h or tmp >= array[j-g[k]]:
                        break
                array[j] = tmp
    print(len(g))
    print(*g)
    for i in range(array): print(array[i])

d = []
for i in range(int(input())):
    d.append(int(input()))
shell_sort(d)
    


Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Time Limit Exceeded):
def shell_sort(array):
    n = len(array)
    h = 0
    k = 0
    cnt = 0
    g = []
    while h <= n/9:
        h = 3*h + 1
        g.append(h)
    while g[k] > 0:
        for i in range(h,n):
            tmp = array[i]
            if tmp < array[i-g[k]]:
                j = i
                while True:
                    array[j] = array[j-g[k]]
                    j -= h
                    cnt += 1
                    if j < h or tmp >= array[j-g[k]]:
                        break
                array[j] = tmp
    print(len(g))
    print(*g)
    print(cnt)
    for i in range(array): print(array[i])

d = []
for i in range(int(input())):
    d.append(int(input()))
shell_sort(d)
    


Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(*G)
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(" ".join(map(str,G)))
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(" ".join(map(int,G)))
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(*G)
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(" ".join(map(str,G)))
    
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9):
	    h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print(len(G))
    print(" ".join(map(str,G)))
    
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)
		
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)



Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print("-----")
	print(len(G))

	print(" ".join(map(str,G)))
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
	cnt = 0
	for i in range(int(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

def shellsort(A,n):
	cnt = 0
	h = 0
	while(h <= n / 9): h = 3*h + 1
	G = []
	while h > 0:
		G.append(h)
		h /= 3
	print("-----")
	print(len(G))

	print(" ".join(map(str,G)))
	for i in range(len(G)):
		insertionSort(A,n,G[i])
	for i in A:
		print(i)	
n = int(input())
A = []
for _ in range(n):
	A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
        cnt = 0
        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
        return cnt
def shellsort(A,n):
        cnt = 0
        h = 1
	G = []
	while h <= 1:
                G.append(h)
                h = 3*h + 1
        G.reverse()

        print(len(G))

        print(" ".join(map(str,G)))
        for i in range(len(G)):
                cnt += insertionSort(A,n,G[i])
        print(cnt)
        for i in A:
                print(i)
n = int(input())
A = []
for _ in range(n):
        A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
	while h <= 1:
        G.append(h)
        h = 3*h + 1
    G.reverse()

    print(len(G))

    print(" ".join(map(str,G)))
    for i in range(len(G)):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= 1:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m

    print(" ".join(map(str,G)))
    for i in range(m:
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)

Buggy python submission (verdict: Runtime Error):
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= 1:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)




Fixed submission:
def insertionSort(A,n,g):
    cnt = 0
    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
    return cnt
    
def shellsort(A,n):
    cnt = 0
    h = 1
    G = []
    while h <= n:
        G.append(h)
        h = 3*h + 1
    G.reverse()
    m = len(G)
    print(m)

    print(" ".join(map(str,G)))
    for i in range(m):
        cnt += insertionSort(A,n,G[i])
    print(cnt)
    for i in A:
        print(i)
        
n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
shellsort(A,n)