#include <bits/stdc++.h>
using namespace std;
const int N = 60;
const int INF = 1e9;
int n;
int a[N], b[N];
inline int cal(int x, int y) {
  if (x < y) swap(x, y);
  int d = x - y;
  return min(d, 24 - d);
}
inline bool check(int x) {
  int mi = INF;
  b[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (cal(a[i], b[i - 1]) < x) {
      b[i] = 24 - a[i];
    }
  }
  sort(b, b + 1 + n);
  for (int i = 1; i <= n; i++) {
    mi = min(mi, cal(b[i], b[i - 1]));
  }
  if (mi >= x) return true;
  mi = INF;
  b[0] = 24;
  for (int i = 1; i <= n; i++) {
    if (cal(a[i], b[i - 1]) < x) {
      b[i] = 24 - a[i];
    }
  }
  sort(b, b + 1 + n);
  for (int i = 1; i <= n; i++) {
    mi = min(mi, cal(b[i], b[i - 1]));
  }
  return mi >= x;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + 1 + n);
  for (int i = 24; i >= 0; i--) {
    if (check(i)) {
      printf("%d\n", i);
      return 0;
    }
  }
}
