#include <bits/stdc++.h>
using namespace std;
vector<int> D;
vector<bool> used;
bool nibu(int m) {
  int time[25] = {};
  for (int i = int(0); i < int(D.size()); i++) {
    time[D[i]]++;
    time[24 - D[i]]++;
  }
  int cur = 0;
  int cnt = 0;
  while (cnt < D.size()) {
    int e = -1;
    for (int i = int(0); i < int(24); i++) {
      if (cur + m <= i && time[i] > 0) {
        e = i;
        break;
      }
    }
    if (e == -1) return false;
    time[e]--;
    time[24 - e]--;
    cur = e;
    cnt++;
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  for (int i = int(0); i < int(n); i++) {
    int tmp;
    cin >> tmp;
    D.push_back(tmp);
  }
  sort(begin(D), end(D));
  int ok = 0;
  int ng = 25;
  while (ng - ok > 1) {
    int mid = (ok + ng) / 2;
    if (nibu(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }
  cout << ok << endl;
  return 0;
}
