#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  T s = 0, f = 1;
  char k = getchar();
  while (!isdigit(k) && (k ^ '-')) k = getchar();
  if (!isdigit(k)) {
    f = -1;
    k = getchar();
  }
  while (isdigit(k)) {
    s = s * 10 + (k ^ 48);
    k = getchar();
  }
  x = s * f;
}
void done() {
  printf("NO\n");
  exit(0);
}
const int MAXN = 100;
int n, a[MAXN];
bool chk(int x) {
  int last = a[1], in = 0;
  for (register int i = (2); i <= (n); ++i) {
    if (a[i] - last >= x) {
      last = a[i];
      continue;
    }
    if (a[i] - in < x) return false;
    in = a[i];
  }
  if (24 - last - in < x) return false;
  return true;
}
int main() {
  read(n);
  for (register int i = (1); i <= (n); ++i) read(a[i]);
  sort(a + 1, a + n + 1);
  if (a[1] == 0 || n >= 23) {
    printf("0\n");
    return 0;
  }
  if (n == 1) {
    printf("%d\n", a[1]);
    return 0;
  }
  for (int i = 3; i <= n; ++i)
    if (a[i - 2] == a[i - 1] && a[i - 1] == a[i]) {
      printf("0\n");
      return 0;
    }
  int l = 1, r = a[1], mid = (l + r) >> 1;
  while (l <= r) {
    if (chk(mid))
      l = mid + 1;
    else
      r = mid - 1;
    mid = (l + r) >> 1;
  }
  printf("%d\n", r);
  return 0;
}
