#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define INF 1<<30
using namespace std;

const int maxn = 55;
int n; 
int a[maxn];
int b[maxn];
int ans;

int getMin()
{
	b[0] = 0;
	for(int i = 1; i <= n ;i ++){
		b[i] = a[i-1];
	}
	sort(b, b + n + 1);
	
	int i, tmp = INF;
	for(i = 0; i < n ;i ++){
		tmp = min(tmp, abs(b[i] - b[i+1]));
	}
	return tmp;
}

void dfs(int i)
{
	//边界条件
	if(i == n){
		ans = max(ans, getMin());
		//cout<<"ans:"<<ans<<endl;
		return ;	
	} 
		
	dfs(i + 1);
	
	if(a[i] == 0){
		return ;
	}
	a[i] = 24 - a[i];  
	dfs(i + 1);
	a[i] = 24 - a[i];
}

int main()
{
	int x, i;
	while(scanf("%d", &n) != EOF){
		ans = 0;
		
		for(i = 0; i < n ;i ++){
			scanf("%d", &a[i]);
		}
		
		dfs(0);
		
		printf("%d\n", ans);
	}
	return 0;	
} 