#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int m;
vector<int> d(0);

void dfs(vector<int> dd, int id, int n){
	if (id == n){
		int tempmin = 24;
		vector<int> cp(dd.size());
		cp = dd;
		for (int i = 0; i < dd.size(); i++){
			for (int j = 0; j < i; j++){
				tempmin = min(tempmin, min(24-abs(dd[i]-dd[j]), abs(dd[i]-dd[j])));
			}
		}
		m = max(m, tempmin);
	}
	else {
		dd.push_back(d[id]);
		dfs(dd, id+1, n);
		dd.pop_back();
		dd.push_back(-d[id]);
		dfs(dd, id+1, n);
		dd.pop_back();
	}
}


int main(void){
	int n, a;

	cin >> n;

	vector<int> dd(1);
	dd[0] = 0;

	for (int i = 0; i < n; i++){
		cin >> a;
		d.push_back(a);
	}

	m = 0;

	if (n >= 24){
		;
	}
	else if (n == 23){
		sort(d.begin(), d.end());
		int ok = 1;
		for (int i = 0; i < n; i++){
			if (d[i] != i/2 + 1)
				ok = 0;
		}
		m = ok;
	}
	else {
		dfs(dd, 0, n);
	}

	cout << m << endl;
}