#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
const int inf = 0x3f3f3f3f;
int a[maxn];
multiset<int> s;
int main() {
  int n;
  scanf("%d", &n);
  s.clear();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  a[0] = 0;
  sort(a + 1, a + n + 1);
  int x1 = 0, x2 = 0;
  int mi = inf;
  for (int i = 1; i <= n; i++) {
    s.insert(a[i] - a[i - 1]);
    if (a[i] - a[i - 1] <= mi) {
      mi = a[i] - a[i - 1];
      x1 = i - 1, x2 = i;
    }
  }
  if (n == 1) {
    printf("%d\n", a[1]);
  } else {
    multiset<int>::iterator it;
    if (x1 == 0) {
      s.erase(a[1] - a[0]);
      s.insert(24 - a[1] - a[n]);
      it = s.cbegin();
      printf("%d\n", *it);
    } else if (x2 == n) {
      int ans = mi;
      s.erase(a[x2] - a[x1]);
      s.insert(a[x2] - a[x1 - 1]);
      s.insert(24 - a[x1] - a[n]);
      it = s.cbegin();
      ans = max(*it, ans);
      s.insert(a[x2] - a[x1]);
      s.erase(a[x2] - a[x1 - 1]);
      s.erase(24 - a[x1] - a[n]);
      s.erase(a[x2] - a[x1]);
      s.insert(24 - a[x2] - a[n - 1]);
      it = s.cbegin();
      ans = max(*it, ans);
      printf("%d\n", ans);
    } else {
      int ans = mi;
      s.erase(a[x2] - a[x1]);
      s.insert(a[x2] - a[x1 - 1]);
      s.insert(24 - a[x1] - a[n]);
      it = s.cbegin();
      ans = max(*it, ans);
      s.insert(a[x2] - a[x1]);
      s.erase(a[x2] - a[x1 - 1]);
      s.erase(24 - a[x1] - a[n]);
      s.erase(a[x2] - a[x1]);
      s.insert(a[x2 + 1] - a[x1]);
      s.insert(24 - a[x2] - a[n]);
      it = s.cbegin();
      ans = max(*it, ans);
      printf("%d\n", ans);
    }
  }
  return 0;
}
