#include <bits/stdc++.h>
using namespace std;
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  for (int n; cin >> n;) {
    vector<int> D(n);
    for (int i = (0); i < (n); i++) {
      cin >> D[i];
    }
    D.push_back(0);
    int N = n + 1;
    sort(begin(D), end(D));
    auto f = [&](const vector<int> &d) {
      int score = 24 - d.back();
      for (int i = (0); i < (N - 1); i++) {
        chmin(score, d[i + 1] - d[i]);
      }
      return score;
    };
    int prev = 0;
    int cur = 0;
    do {
      prev = cur;
      cur = 24 - D.back();
      int idx = N - 1;
      for (int i = (0); i < (N - 1); i++) {
        if (chmin(cur, D[i + 1] - D[i])) idx = i;
      }
      vector<int> a = D, b = D;
      a.push_back(24 - a[idx]);
      b.push_back(24 - (b[(idx + 1) % N]));
      a.erase(a.begin() + idx);
      b.erase(b.begin() + (idx + 1) % N);
      sort(begin(a), end(a));
      sort(begin(b), end(b));
      int sa = f(a), sb = f(b);
      if (sa > sb)
        D = a;
      else
        D = b;
      cur = f(D);
      ;
    } while (cur > prev);
    cout << prev << endl;
  }
  return 0;
}
