#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
int p[25];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  int n;
  cin >> n;
  int m = 0;
  for (int i = 0; i < (int)(n); ++i) {
    int x;
    cin >> x;
    m |= 1 << x;
  }
  int ans = 0;
  for (int mm = 0; mm < (int)((1 << 13)); ++mm) {
    for (int j = 0; j < (int)(25); ++j) p[j] = 0;
    p[12] = 1;
    for (int i = 0; i < (int)(13); ++i) {
      if (!((m >> i) & 1)) continue;
      if ((mm >> i) & 1)
        p[12 + i] = 1;
      else
        p[12 - i] = 1;
    }
    int s = 100;
    for (int i = 0; i < (int)(25); ++i)
      for (int j = 0; j < (int)(i); ++j)
        if (p[i] && p[j]) uin(s, min(i - j, 24 - (i - j)));
    uax(ans, s);
  }
  cout << ans << '\n';
  return 0;
}
