n = int(input())
ds = list(set(map(int, input().split())))

ans = 0
for i in range(len(ds)):
    mx = 1000
    for j in range(len(ds)):
        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])), abs(ds[j]-(24-ds[i])))
            #print("ds[{}], ds[{}]={},{}".format(i, j, ds[i], ds[j]))
            #print("mx:{}".format(mx))
    ans = max(ans, mx)
    #print("ans={}".format(ans))
print(ans if n>1 else 0)