#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int linf = 1LL << 50;
const double EPS = 1e-10;
int main(int argc, char const* argv[]) {
  int n;
  cin >> n;
  vector<int> d;
  for (int i = (0); i < (n); ++i) {
    int x;
    cin >> x;
    d.push_back(x);
  }
  d.push_back(0);
  sort(d.begin(), d.end());
  if (d[1] == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> l, r;
  for (int s = 12; s >= 0; s--) {
    l.clear();
    r.clear();
    l.push_back(0);
    bool flag = true;
    for (int j = (1); j < (d.size()); ++j) {
      int ltmp = d[j] - l[l.size() - 1];
      int rtmp = inf;
      if (r.size() > 0) {
        rtmp = d[j] - r[r.size() - 1];
      }
      if (ltmp < rtmp) {
        if (ltmp < s) {
          if (rtmp < s) {
            flag = false;
            break;
          } else {
            r.push_back(d[j]);
          }
        } else {
          l.push_back(d[j]);
        }
      } else {
        if (rtmp < s) {
          if (ltmp < s) {
            flag = false;
            break;
          } else {
            l.push_back(d[j]);
          }
        } else {
          r.push_back(d[j]);
        }
      }
    }
    if (!flag) continue;
    for (int j = (1); j < (l.size()); ++j) {
      if (l[j] - l[j - 1] < s) {
        flag = false;
        break;
      }
    }
    for (int j = (1); j < (r.size()); ++j) {
      if (r[j] - r[j - 1] < s) {
        flag = false;
        break;
      }
    }
    if (!flag) continue;
    if (r.size() > 0) {
      if (24 - r[r.size() - 1] - l[l.size() - 1] < s) {
        continue;
      }
    }
    cout << s << endl;
    return 0;
  }
  return 0;
}
