#include <bits/stdc++.h>
using namespace std;
const string temp = "AKIHABARA";
int vis[26], enu[110];
int main() {
  int n;
  cin >> n;
  if (n == 0) {
    while (true)
      ;
  }
  vector<int> ele;
  ele.resize(n);
  for (int i = 0; i < n; i++) cin >> ele[i];
  for (int i = 0; i < n; i++) {
    vis[ele[i]]++;
    if (ele[i] == 0 || vis[ele[i]] > 2) {
      puts("0");
      return 0;
    }
  }
  sort(ele.begin(), ele.end());
  ele.erase(unique(ele.begin(), ele.end()), ele.end());
  int tot = ele.size(), res = 0;
  for (int i = 0; i < (1 << tot); i++) {
    int top = 0;
    enu[top++] = 0;
    for (int j = 0; j < tot; j++)
      enu[top++] = (i & (1 << j)) ? ele[j] : 24 - ele[j];
    sort(enu, enu + top);
    int best = 24;
    for (int j = 1; j < top; j++) {
      best = min(best, enu[j] - enu[j - 1]);
    }
    best = min(best, 24 - enu[top - 1]);
    for (int j = 0; j < tot; j++) {
      if (vis[ele[j]] > 1) best = min(best, 24 - ele[j] * 2);
    }
    res = max(res, best);
  }
  cout << res << endl;
  return 0;
}
