# coding: utf-8

import itertools
import collections


def main():
    n = int(input())
    c = collections.Counter(map(int, input().split()))
    if c[0] > 0:
        return 0
    if c.most_common(1)[0][1] >= 3:
        return 0
    l1 = []
    l2 = []
    for i, cnt in c.most_common():
        if cnt == 2:
            l2.append(i)
        elif cnt == 1:
            l1.append(i)
    s = 0
    for i in range(len(l1) + 1):
        for invs in itertools.combinations(l1, i):
            l = [0]
            for k in l1:
                l.append(-k if k in invs else k)
            for k in l2:
                l.append(k)
                l.append(-k)
            l.sort()
            ss = 24
            for j in range(len(l)-1):
                ss = min(l[j + 1] - l[j], ss)
            d = l[-1] - l[0]
            ss = min(min(d, 24-d), ss)
            s = max(s, ss)

    return s

print(main())
