#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > que;
int main() {
  int N, D[50];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf(" %d", &D[i]);
    que.push(D[i]);
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i < j) {
        int MIN, MMIN, MAX;
        int lar = max(D[i], D[j]), sma = min(D[i], D[j]);
        MIN = min(lar - sma, 24 - (lar - sma));
        MMIN = min((24 - lar) - sma, 24 - ((24 - lar) - sma));
        MAX = max(MIN, MMIN);
        que.push(MAX);
      }
    }
  }
  printf("%d\n", que.top());
  return 0;
}
