#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
pair<long long, long long> Dir[8] = {{0, 1}, {-1, 0}, {1, 0},  {0, -1},
                                     {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
struct Edge {
  int from, to;
  long long w;
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long m, long long n) { return m * n / gcd(m, n); }
long long gettugibaisu(long long from, long long k) {
  long long ret = ((from + k - 1) / k) * k;
  return ret;
}
long long getmaebaisu(long long to, long long k) {
  long long ret = (to / k) * k;
  return ret;
}
signed main(void) {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = (0); (n) > i; i++) {
    cin >> d[i];
    if (d[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  sort((d).begin(), (d).end());
  if (n >= 24) {
    cout << 0 << endl;
    return 0;
  }
  int Max = 0;
  int tori = pow(2, n);
  for (int i = (0); (tori) > i; i++) {
    int Min = 300;
    int bef = 0;
    for (int j = (0); (2 * n) > j; j++) {
      bool f = ((i >> j % n) & 1);
      if (f && j >= n) {
        Min = min(Min, 24 - d[j % n] - bef);
        bef = 24 - d[j % n];
      }
      if (!f && j < n) {
        Min = min(Min, d[j % n] - bef);
        bef = d[j % n];
      }
    }
    Max = max(Max, Min);
  }
  cout << Max << endl;
  return 0;
}
