#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef int status;
typedef long long LL;
const int INF = int(1e9);
const int MAX = 400002;

int N;
int a[MAX];

int main()
{
    cin>>N;
    for(int i = 1;i<=N;i++)
        cin>>a[i];
    sort(a+1,a+1+N);

    for(int i = 1;i<=N;i++)
    {
        if(i%2==0)
        {
            a[i] = 24 - a[i];
        }
    }
    sort(a+1,a+1+N);

    int maxn = 25;
    for(int i = 1;i<=N;i++)
    {
        maxn = min(maxn,a[i] - a[i-1]);
    }

    cout<<maxn<<endl;

    return 0;
}
