#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> d(n);
  for (long long i = (0); i < (n); i++) cin >> d[i];
  vector<long long> check(13, 0);
  check[12]++;
  bool flag = false;
  for (long long i = (0); i < (n); i++) {
    if (d[i] == 0) flag = true;
    check[d[i]]++;
    if (check[d[i]] >= 3) flag = true;
  }
  if (flag) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 0;
  for (long long i = (0); i < (1 << n); i++) {
    vector<long long> tmp(n + 1, 0);
    for (long long j = (0); j < (n); j++) {
      if (1 << j & i)
        tmp[j] = d[j];
      else
        tmp[j] = 24 - d[j];
    }
    sort(tmp.begin(), tmp.end());
    long long mn = 24;
    for (long long j = (0); j < (n); j++) mn = min(mn, tmp[j + 1] - tmp[j]);
    mn = min(mn, tmp[0] + 24 - tmp[n]);
    ans = max(ans, mn);
  }
  cout << ans << endl;
  return 0;
}
