#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <class T1, class T2>
void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
using Pi = pair<long long, long long>;
using Ti = tuple<long long, long long, long long>;
using vint = vector<long long>;
const long long inf = 1LL << 55;
const long long mod = 1e9 + 7;
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  long long n;
  cin >> n;
  vint d(n);
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(n); i++) cin >> d[i];
  d.push_back(0);
  n++;
  sort((d).begin(), (d).end());
  auto check = [&](long long m) {
    long long now = 0;
    vint used(n, 0);
    used[now] = 1;
    for (long long i = (long long)(0); i < (long long)(n - 1); i++) {
      long long nex = -1;
      long long val = 0;
      for (long long j = (long long)(0); j < (long long)(n); j++) {
        if (used[j]) continue;
        if (nex == -1) {
          long long a = abs(d[now] - d[j]);
          long long b = abs(24 - (d[now] + d[j]));
          if (a > b) swap(a, b);
          if (a >= m) {
            nex = j;
            val = a;
          } else if (b >= m) {
            nex = j;
            val = b;
          }
        } else {
          long long a = abs(d[now] - d[j]);
          long long b = abs(24 - (d[now] + d[j]));
          if (a > b) swap(a, b);
          if (a >= m && a < val) {
            nex = j;
            val = a;
          } else if (b >= m && b < val) {
            nex = j;
            val = b;
          }
        }
      }
      if (nex == -1) return false;
      used[nex] = 1;
      now = nex;
    }
    return min(abs(d[now] - d[0]), abs(24 - (d[now] - d[0]))) >= m;
  };
  long long lb = 0, ub = 13;
  while (lb + 1 < ub) {
    long long mb = (lb + ub) / 2;
    if (check(mb))
      lb = mb;
    else
      ub = mb;
  }
  cout << lb << endl;
  return 0;
}
