Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
D.sort()
for i in range(N):
    diff[D[i]] += 1

if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

for i in range(13):
    if diff[i] > 2:
        print(0)
        exit(0)

ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
D.sort()
for i in range(N):
    diff[D[i]] += 1

if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

for i in range(13):
    if diff[i] > 2:
      print(0)
      exit(0)

ans = [0]
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
D.sort()
for i in range(N):
    diff[D[i]] += 1

if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

for i in range(13):
    if diff[i] > 2:
    print(0)
    exit(0)

ans = [0]
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
D.sort()
for i in range(N):
    diff[D[i]] += 1
    if diff[i] > 2:
        print(0)
        exit(0)
if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

ans = [0]
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
# D.sort()
for i in range(N):
    diff[D[i]] += 1
    if diff[i] > 2:
        print(0)
        exit(0)
if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

ans = [0]
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))

diff = [0]*13
# D.sort()
for i in range(N):
    diff[D[i]] += 1
    if diff[i] > 2:
        print(0)
        exit(0)
if diff[0] > 0:
    print(0)
    exit(0)
else:
    diff2 = [diff[12 - i] for i in range(1, N-1)]

ans = []
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
D = list(map(int, input().split()))
D.sort()

ans = []
for i in range(N):
    if i % 2 == 0:
        ans.append(D[i])
    else:
        ans.append(24 - D[i])

ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)]

print(min(ans))


Fixed submission:
N = int(input())
D = list(map(int, input().split()))


D.sort()
ans = [0]
ans = [D[i]
       for i in range(N) if i % 2 == 0] + [24 - D[i] for i in reversed(range(N)) if i % 2 == 1]

ans = [0] + ans + [0]

ans = [abs(ans[i+1] - ans[i]) for i in range(N+1)]

print(min(ans))