#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
signed main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> d(n);
  for (long long i = 0; i < (n); i++) cin >> d[i];
  if (n >= 24) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 0;
  for (long long bit = 0; bit < (1 << n); bit++) {
    bitset<24> st;
    long long tmp = 10000000000000000;
    for (long long i = 0; i < (n); i++) {
      if (d[i] == 0) {
        tmp = 0;
        break;
      }
      if ((1 << i) & bit) {
        if (st[d[i]]) {
          tmp = 0;
          break;
        }
        st[d[i]] = true;
      } else {
        if (st[24 - d[i]]) {
          tmp = 0;
          break;
        }
        st[24 - d[i]] = true;
      }
    }
    long long cur = 0;
    for (long long i = 0; i < (24); i++) {
      if (st[i]) {
        chmin(tmp, i - cur);
        cur = i;
      }
    }
    chmax(ans, tmp);
  }
  cout << ans << endl;
}
