#include <bits/stdc++.h>
using namespace std;
int N, D[51], T[51], ans, a, b;
int iabs(int a) { return a < 0 ? -a : a; }
int main() {
  cin >> N;
  D[0] = 0;
  for (int i{1}; i <= N; ++i) cin >> D[i];
  for (int i{}; i <= N; ++i) {
    for (int j{}; j <= N; ++j) T[j] = iabs(D[i] - D[j]);
    vector<int> v;
    v.emplace_back(0), v.emplace_back(24);
    int res = 24;
    for (int j{}; j <= N; ++j) {
      if (i == j) continue;
      int r1, r2;
      r1 = r2 = numeric_limits<int>::max();
      for (auto& t : v)
        r1 = min(r1, iabs(t - T[j])), r2 = min(r2, iabs(t - 24 + T[j]));
      res = min(res, max(r1, r2));
      v.emplace_back(r1 < r2 ? 24 - T[j] : T[j]);
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
}
