#include <bits/stdc++.h>
using namespace std;
long long dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
long long kaijo[200010];
struct edge {
  long long to, cost;
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool prime(long long a) {
  if (a == 1) return false;
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
bool kosa(double ax, double ay, double bx, double by, double cx, double cy,
          double dx, double dy) {
  double ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);
  double tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);
  double tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);
  double td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);
  return tc * td < 0 && ta * tb < 0;
}
void init_fact(long long n) {
  kaijo[0] = 1;
  for (long long i = 1; i <= n; i++) {
    kaijo[i] = kaijo[i - 1] * i;
    kaijo[i] %= 1000000007;
  }
}
long long modpow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2) return modpow(a, b - 1) * a % 1000000007;
  long long memo = modpow(a, b / 2);
  return memo * memo % 1000000007;
}
long long comb(long long a, long long b) {
  if (b > a) return 0;
  if (a == b) return 1;
  return kaijo[a] * modpow(kaijo[a - b], 1000000007 - 2) % 1000000007 *
         modpow(kaijo[b], 1000000007 - 2) % 1000000007;
}
long long g(long long x) {
  x = modpow(x, 1000000007 - 2);
  return x;
}
long long n, a[55], cnt[15], ans;
signed main() {
  cin >> n;
  cnt[0]++;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  if (n > 24) {
    puts("0");
    return 0;
  }
  if (n > 12) {
    if (cnt[0] >= 2 || cnt[12] >= 2) {
      puts("0");
      return 0;
    }
    for (long long i = 1; i <= 11; i++) {
      if (cnt[i] >= 3) {
        puts("0");
        return 0;
      }
    }
    cout << 1 << endl;
    return 0;
  }
  if (cnt[11] >= 2) {
    puts("0");
    return 0;
  }
  for (long long i = 0; i < (1 << n); i++) {
    vector<long long> v;
    for (long long j = 0; j < n; j++) {
      if ((i >> j) & 1)
        v.push_back(a[j]);
      else
        v.push_back(24 - a[j]);
    }
    v.push_back(0);
    v.push_back(24);
    sort(v.begin(), v.end());
    long long memo = 24;
    for (long long j = 0; j < v.size() - 1; j++)
      memo = min(memo, v[i + 1] - v[i]);
    ans = max(ans, memo);
  }
  cout << ans << endl;
  return 0;
}
