#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;


ll n, a[51];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	ll anss=-1;
	for(int t = 0; t < 100000; t++){
		ll ans=INF;
		sort(a,a+n+1);
		for(int i = 0; i <= n; i++){
			if(i%2){
				a[i]=24-a[i];
			}
		}
		for(int i = 0; i <= n; i++){
			for(int j = i+1; j <= n; j++){
				ans=min(ans,abs(a[i]-a[j]));
			}
		}
		anss=max(ans,anss);
	}
	cout << anss << endl;
	return 0;
}
