import sys
N = int(input())
D = [int(d) for d in input().split()]

if 0 in D:
    print(0)
    sys.exit()

for i in range(N):
    if D[i] > 12:
        D[i] = 24 - D[i]
D.append(0)

max_val = 0

for i in range(N ** 2):
    D.sort()
    min_val = 24
    min_idx = 0
    prev = D[0]
    for i in range(1, N + 1):
        if D[i] - prev < min_val:
            min_val = D[i] - prev
            min_idx = i
        prev = D[i]
    if min_val > max_val:
        max_val = min_val
    D[min_idx] = 24 - D[min_idx]

print(max_val)
