#設定
import sys
input = sys.stdin.buffer.readline

from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	D = getlist()
	if N >= 24:
		print(0)
	elif N >= 12:
		d = defaultdict(int)
		judge = "Yes"
		for i in D:
			d[i] += 1
		if d[0] >= 1:
			judge = "No"
		if d[12] >= 2:
			judge = "No"
		for i in range(1, 12):
			if d[i] >= 3:
				judge = "No"
		if judge == "No":
			print(0)
		else:
			print(1)
	else:
		ans = 0
		for i in range(1 << N):
			L = [0, 24]
			for j in range(N):
				if ((i >> j) & 1) == 1:
					L.append(D[j])
				else:
					L.append(24 - D[j])
			L = sorted(L)
			val = 24
			for i in range(N + 1):
				val = min(val, L[i + 1] - L[i])
			ans = max(ans, val)
		print(ans)

if __name__ == '__main__':
	main()