#include <bits/stdc++.h>
using namespace std;
template <typename tuple<long long int, long long int, long long int> >
void fill_all(tuple<long long int, long long int, long long int> &arr,
              const tuple<long long int, long long int, long long int> &v) {
  arr = v;
}
template <typename tuple<long long int, long long int, long long int>,
          typename ARR>
void fill_all(ARR &arr,
              const tuple<long long int, long long int, long long int> &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> s;
  for (long long int i = (signed)(0); i < (n); ++i) {
    long long int h;
    cin >> h;
    if (h == 0) {
      cout << 0 << endl;
      return 0;
    }
    s.push_back(h);
  }
  sort(s.begin(), s.end());
  bool flag[50] = {};
  for (long long int i = (signed)(0); i < ((signed)s.size() - 1); ++i) {
    if (s[i] == s[i + 1]) {
      if (flag[s[i]] == true) {
        cout << 0 << endl;
        return 0;
      }
      flag[s[i]] = true;
    }
  }
  s.erase(std::unique(s.begin(), s.end()), s.end());
  long long int maxe = 0;
  for (long long int i = (signed)(0); i < (1 << s.size()); ++i) {
    vector<long long int> se;
    long long int maxa = 93193111451418101;
    se.push_back(0);
    for (long long int j = (signed)(0); j < (s.size()); ++j) {
      if (flag[s[j]]) {
        se.push_back(s[j]);
        se.push_back(24 - s[j]);
      } else if ((i >> j) & 1) {
        if (s[j] == 0) {
          se.push_back(0);
        } else {
          se.push_back(24 - s[j]);
        }
      } else {
        se.push_back(s[j]);
      }
    }
    sort(se.begin(), se.end());
    for (long long int i = (signed)(0); i < (se.size() - 1); ++i) {
      maxa = min(maxa, se[i + 1] - se[i]);
    }
    if (maxa == 93193111451418101) {
      maxa = 0;
    }
    maxe = max(maxa, maxe);
  }
  cout << maxe << endl;
}
