#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>

using namespace std;

void solve(int n, vector<int> d) {
    sort(d.begin(), d.end());
    // int l = 0;
    //int r = 0;
    //int ret = 24;
    for (int i = 0; i < d.size(); i+=2) {
        d[i] = 24 - d[i];
    }
    sort(d.begin(), d.end());
    int ret = 24;
    int a = 0;
    for (int i = 0; i < d.size(); i++) {
        ret = min(ret, d[i] - a);
        a = d[i];
    }
    ret = min(ret, 24 - d.back());
    std::cout << ret << std::endl;
}

int main() {
    struct timeval start,end;
    long long span;
    int n;

    gettimeofday(&start,NULL);

    std::cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        std::cin >> d[i];
    }
    solve(n, d);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}
