n = int(input())
t = [0]*24
t[0] = 1
a = 1
for i in sorted(list(map(int, input().split()))):
    t[a*i] += 1
    a *= -1
for i in t:
  if i > 1:
    print(0)
    break
else:
  m = 24
  c = 1
  t += [1]
  for i in t[1:]:
    if i == 1:
      if m > c:
        m = c
      c = 1
    else:
      c += 1       
  print(m)