#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T& a, T b) {
  a = max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = min(a, b);
}
bool prime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return x > 1;
}
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int kai(int x, int y) {
  int res = 1;
  for (int i = x - y + 1; i <= x; i++) {
    res *= i;
    res %= (int)(1e9 + 7);
  }
  return res;
}
int mod_pow(int x, int y, int m) {
  int res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x % m;
    }
    x = x * x % m;
    y >>= 1;
  }
  return res;
}
int comb(int x, int y) {
  if (y > x) return 0;
  return kai(x, y) * mod_pow(kai(y, y), (int)(1e9 + 7) - 2, (int)(1e9 + 7)) %
         (int)(1e9 + 7);
}
int get_rand(int MIN, int MAX) {
  random_device rnd;
  mt19937_64 mt64(rnd());
  uniform_int_distribution<int> engine(MIN, MAX);
  return engine(mt64);
}
int n, d[55];
signed main() {
  cin >> n;
  if (n > 24) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) cin >> d[i];
  int ma = 0;
  for (int i = 0; i < 1 << n; i++) {
    vector<int> v;
    for (int j = 0; j < n; j++) {
      if (i >> j & 1)
        v.push_back(d[j]);
      else
        v.push_back(24 - d[j]);
    }
    v.push_back(0);
    v.push_back(24);
    sort(v.begin(), v.end());
    int ans = 24;
    for (int i = 0; i < v.size() - 1; i++) {
      chmin(ans, v[i + 1] - v[i]);
    }
    chmax(ma, ans);
  }
  cout << ma << endl;
}
