#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> d[i];
  }
  int res = 0;
  vector<int> t(13, 0);
  for (long long i = 0; i < (long long)(n); i++) {
    t[d[i]]++;
  }
  bool flag = false;
  for (long long i = 0; i < (long long)(13); i++) {
    if (t[i] > 2) {
      flag = true;
    }
  }
  if (flag) {
    cout << 0 << "\n";
    return 0;
  }
  for (int bit = 0; bit < (1 << n); ++bit) {
    vector<int> a(n + 1);
    a[0] = 0;
    for (long long i = 0; i < (long long)(n); i++) {
      if (bit & (1 << i)) {
        a[i + 1] = d[i];
      } else {
        a[i + 1] = 24 - d[i];
      }
    }
    sort((a).begin(), (a).end());
    int dif = 100;
    for (long long i = 0; i < (long long)(n); i++) {
      chmin(dif, a[i + 1] - a[i]);
    }
    chmin(dif, 24 + a[0] - a[n]);
    chmax(res, dif);
  }
  cout << res << "\n";
  return 0;
}
