#include <bits/stdc++.h>
using namespace std;
long long n, a[55];
signed main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  vector<long long> vec;
  long long ans = 0;
  for (long long j = 0; j < n; j++) vec.push_back(24 - a[j]);
  sort(vec.begin(), vec.end());
  long long cnt = LLONG_MAX / 1000;
  for (long long i = 0; i < vec.size() - 1; i++) {
    cnt = min(cnt, vec[i + 1] - vec[i]);
    cnt = min(cnt, vec[i]);
  }
  cnt = min(cnt, min(vec.back() - vec[0], 24 - (vec.back() - vec[0])));
  cnt = min(cnt, vec.back());
  ans = cnt;
  for (long long i = 0; i < n - 1; i++) {
    vec.clear();
    for (long long j = 0; j < i + 1; j++) vec.push_back(a[j]);
    for (long long j = i + 1; j < n; j++) vec.push_back(24 - a[j]);
    sort(vec.begin(), vec.end());
    long long cnt = LLONG_MAX / 1000;
    for (long long i = 0; i < vec.size() - 1; i++) {
      cnt = min(cnt, vec[i + 1] - vec[i]);
      cnt = min(cnt, vec[i]);
    }
    cnt = min(cnt, min(vec.back() - vec[0], 24 - (vec.back() - vec[0])));
    cnt = min(cnt, vec.back());
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
