#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "cmath"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	vector<int>v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	vector<int>ti(13);
	for (int i = 0; i < N; i++) {
		ti[v[i]]++;
		if (ti[v[i]] == 3) {
			cout << 0 << endl;
			return 0;
		}
	}
	if (ti[0]) {
		cout << 0 << endl;
		return 0;
	}
	if (ti[12] == 2) {
		cout << 0 << endl;
		return 0;
	}
	if (N > 13) {
		cout << 1 << endl;
		return 0;
	}
	int ans = 0;
	for (int i = 0; i < pow(2, N); i++) {
		vector<int>box;
		box.push_back(0);
		for (int j = 0; j < N; j++) {
			if (i >> j & 1) {
				box.push_back(v[j]);
			}
			else {
				box.push_back(-v[j]);
			}
		}
		sort(box.begin(), box.end());
		int bag = 100;
		for (int i = 0; i < N; i++) {
			bag = min(bag, box[i + 1] - box[i]);
		}
		bag = min(bag, box[0] + 24 - box[N]);
		ans = max(ans, bag);
	}
	cout << ans << endl;
	return 0;
}