import collections
import numpy as np

N = int(input())
D = list(map(int, input().split()))
D.append(0)
m = 0

while 1:
    D.sort()
    Dsub = [(D[i+1] - D[i]) for i in range(len(D)-1)]
    Dsub.sort()

    if m >= Dsub[0]:
        break
    else:
        m = Dsub[0]
        Dsub1 = [(D[i+1] - D[i]) for i in range(len(D)-1)]
        index = Dsub1.index(m)
        D[index] = abs(24 - D[index])

print(m)
