n = int(input())
ds = list(map(int, input().split()))
ans = 0
for i in range(n):
    mx = 1000
    for j in range(n):
        if i!=j:
            if ds[i]==ds[j]:
                mx = min(mx, abs(ds[i]-(24-ds[j])))
            else:
                mx = min(mx, abs(ds[i]-ds[j]), abs(ds[i]-(24-ds[j])))
    ans = max(ans, mx)
print(ans if n>1 else 0)