#include <bits/stdc++.h>
using namespace std;
vector<int> e;
int a[13], bes;
void dfs(int i) {
  if (i == 13) {
    vector<int> f(e);
    sort(f.begin(), f.end());
    f.push_back(24 + a[0]);
    int cur = 99;
    for (int i = 0; i + 1 < f.size(); i++) {
      int w = f[i + 1] - f[i];
      cur = min(cur, min(w, 24 - w));
    }
    if (cur > bes) bes = cur;
    return;
  }
  if (a[i] == 0) {
    dfs(i + 1);
    return;
  }
  if (i == 0 || i == 12) {
    e.push_back(i);
    dfs(i + 1);
    e.pop_back();
    return;
  }
  if (a[i] == 2) {
    e.push_back(i);
    e.push_back(24 - i);
    dfs(i + 1);
    e.pop_back();
    e.pop_back();
    return;
  }
  e.push_back(i);
  dfs(i + 1);
  e.pop_back();
  e.push_back(24 - i);
  dfs(i + 1);
  e.pop_back();
}
int main() {
  int n, x, mx = 1;
  a[0]++;
  for (scanf("%d", &n); n--;) {
    scanf("%d", &x);
    a[x]++;
    if (a[x] > mx) mx = a[x];
  }
  if (a[0] >= 2 || a[12] >= 2 || mx >= 3) {
    puts("0");
    return 0;
  }
  bes = 0;
  dfs(0);
  printf("%d\n", bes);
  return 0;
}
