#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define N 100
using namespace std;
int a[N];
int n;
int main()
{
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    for (int i=n;i>=1;i--)
        if (i%2==0)
          a[i]=24-a[i];
    sort(a+1,a+1+n);
    int maxn=24;
    for (int i=1;i<=n;i++)
        maxn=min(maxn,a[i]-a[i-1]);
    cout << maxn << endl;
    return 0;
}
