#include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
using namespace std;
template<typename T>inline void read(T &x)
{
	T s=0,f=1;char k=getchar();
	while(!isdigit(k)&&(k^'-'))k=getchar();
	if(!isdigit(k)){f=-1;k=getchar();}
	while(isdigit(k)){s=s*10+(k^48);k=getchar();}
	x=s*f;
}
/*void init()
{
}
void solve()
{
}*/
const int MAXN=100;
int n,a[MAXN];
bool chk(int x)
{
	int last=a[1],in=0;
	Rep(i,2,n)
	{
		if(a[i]-last>=x)
		{
			last=a[i];
			continue;
		}
		if(a[i]-in<x)return false;
		in=a[i];
	}
	if(24-last-in<x)return false;
	return true;
}
int main()
{
	read(n);
	Rep(i,1,n)read(a[i]);
	sort(a+1,a+n+1);
	if(a[1]==0||n>=24)
	{
		printf("0\n");
		return 0;
	}
	if(n==1)
	{
		printf("%d\n",a[1]);
		return 0;
	}
	int l=1,r=a[1],mid=(l+r)>>1;
	while(l<=r)
	{
		if(chk(mid))l=mid+1;
		else r=mid-1;
		mid=(l+r)>>1;
	}
	printf("%d\n",r);
	//init();
	//solve();
	return 0;
}


