#include <bits/stdc++.h>
using namespace std;
const int maxn = 5050;
int mark[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++) {
    vector<int> cloc;
    for (int f = 0; f < val.size(); f++) {
      if (e & (1 << f))
        cloc.push_back(24 - val[f]);
      else
        cloc.push_back(val[f]);
    }
    sort(cloc.begin(), cloc.end());
    int mn = 25;
    for (int f = 1; f < cloc.size(); f++) mn = min(mn, cloc[f] - cloc[f - 1]);
    if (mn == 25) mn = 0;
    ans = max(ans, mn);
  }
  cout << ans << endl;
  return 0;
}
