#include <bits/stdc++.h>
using namespace std;
int a[60];
int n;
bool done[60];
bool F(int lim) {
  for (int i = 0; i < n; i++) done[i] = false;
  int bef = -100;
  for (int i = 0; i < n; i++) {
    if (a[i] - bef < lim) continue;
    bef = a[i];
    done[i] = true;
  }
  for (int i = 0; i < n; i++) {
    if (done[i] == false) {
      int x = 24 - a[i];
      if (x - bef < lim) return false;
      bef = x;
    }
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  a[n] = 0;
  n++;
  sort(a, a + n);
  int maxi = -1;
  for (int i = 0; i < 30; i++) {
    if (F(i) == true) maxi = i;
  }
  cout << maxi << endl;
  return 0;
}
