Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
if gap[0]:
    gap.remove(0)
m = len(gap)
for i in range(m):
    for idx in range(gap[i], n):
        j = idx - gap[i]
        while j >= 0 and data[j] > data[j+gap[i]]:
            data[j+gap[i]], data[j] = data[j], data[j+gap[i]]
            j -= gap[i]
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
if gap[0]:
    gap.remove(0)
m = len(gap)
for i in range(m):
    for idx in range(gap[i], n):
        j = idx - gap[i]
        while j >= 0 and data[j] > data[j+gap[i]]:
            data[j+gap[i]], data[j] = data[j], data[j+gap[i]]
            j -= gap[i]
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
m = len(gap)
for i in range(m):
    for idx in range(gap[i], n):
        j = idx - gap[i]
        while j >= 0 and data[j] > data[j+gap[i]]:
            data[j+gap[i]], data[j] = data[j], data[j+gap[i]]
            j -= gap[i]
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
m = len(gap)
for i in range(m):
    gi = gap[i]
    for idx in range(gap[i], n):
        j = idx - gap[i]
        while j >= 0 and data[j] > data[j+gi]:
            data[j+gi], data[j] = data[j], data[j+gi]
            j -= gi
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, n
while g >= 1:
    g //= 2
    gap.append(g)
m = len(gap)
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = [gap[i] for i in range(m-1, -1, -1)]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = [gap[i] for i in range(m-1, -1, -1)]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
import sys

n, gap = int(input()), []
data = [int(i) for i in sys.stdin.readlines()]
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = gap[::-1]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
n, gap = int(input()), []
data = list(map(int, [input() for i in range(n)]))
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = gap[::-1]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
import sys

n, gap = int(input()), []
data = [int(i) for i in sys.stdin.readlines()]
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = gap[::-1]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        while j >= 0 and data[j] > data[j+i]:
            data[j+i], data[j] = data[j], data[j+i]
            j -= i
            cnt += 1
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])

Buggy python submission (verdict: Runtime Error):
import sys

n, gap = int(input()), []
data = [int(i) for i in sys.stdin.readlines()]
cnt, g = 0, 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
gap = gap[::-1]
for i in gap:
    for idx in range(i, n):
        j = idx - i
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+i] = data[j]
            j -= i
            cnt += 1
        data[j+i] = v
print(m)
print(" ".join(map(str, gap)))
print(cnt)
for i in range(n):
    print(data[i])



Fixed submission:
import sys

def shellSort(data, cnt, g, n):
    for idx in range(g, n):
        j = idx - g
        v = data[idx]
        while j >= 0 and data[j] > v:
            data[j+g] = data[j]
            j -= g
            cnt += 1
        data[j+g] = v
    return data, cnt

n, gap = int(input()), []
a = ([int(i) for i in sys.stdin.readlines()], 0)
g = 0
while g <= n//9:
    g = 3 * g + 1
    gap.append(g)
m = len(gap)
for i in gap[::-1]:
    a = shellSort(a[0], a[1], i, n)
print(m)
print(" ".join(map(str, gap[::-1])))
print(a[1])
for i in range(n):
    print(a[0][i])