#include <bits/stdc++.h>
using namespace std;
int ma = 0;
int tim[13] = {};
int n;
int mm = 0;
void dfs(int depth, int s) {
  if (depth == 13 || depth == mm + 1) {
    if (s != 1047483647) ma = max(s, ma);
    return;
  }
  int s2 = s;
  for (int i = 0; i < depth; i++) {
    if (tim[i] > 0) {
      s = min(s, abs(depth - i));
      s = min(s, i);
      if (depth != 0) {
        s2 = min(s2, abs((24 - depth) - i));
        s2 = min(s2, abs(24 - i));
      }
    }
  }
  if (tim[depth] >= 2) {
    s = 0;
    if (depth != 0) s2 = min(s2, 24 - 2 * depth);
  }
  dfs(depth + 1, s);
  dfs(depth + 1, s2);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    tim[a]++;
  }
  for (int i = 12; i >= 0; i--)
    if (tim[i]) {
      mm = i;
      break;
    }
  dfs(0, 1047483647);
  cout << ma << endl;
  return 0;
}
