#include <bits/stdc++.h>
using namespace std;
const int maxn = 24;
int mark[maxn];
int mk[maxn];
int main() {
  int n;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    mark[x]++;
  }
  for (int e = 0; e < 13; e++) mark[e] = min(mark[e], 2);
  vector<int> val;
  for (int e = 0; e < 13; e++)
    while (mark[e]--) val.push_back(e);
  int ans = 0;
  for (int e = 0; e < 1 << val.size(); e++) {
    memset(mk, 0, sizeof(mk));
    for (int f = 0; f < val.size(); f++) {
      if (e & (1 << f))
        mk[24 - val[f]] = 1;
      else
        mk[val[f]] = 1;
    }
    int lst = -1, val = 25;
    for (int e = 0; e < maxn; e++) {
      if (mk[e]) {
        if (lst != -1) {
          int mt = e - lst;
          val = min(val, min(mt, 24 - mt));
        }
        lst = e;
      }
    }
    if (val == 25) val = 0;
    ans = max(ans, val);
  }
  cout << ans << endl;
  return 0;
}
