#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
using namespace std;
void CINT() {}
template <class Head, class... Tail>
void CINT(Head&& head, Tail&&... tail) {
  cin >> head;
  CINT(move(tail)...);
}
template <class T = long long>
T IN() {
  T x;
  cin >> x;
  return (x);
}
template <class Head>
void VT(Head head) {}
template <class Head, class Seco, class... Tail>
void VT(Head&& head, Seco&& seco, Tail&&... tail) {
  seco.resize(head);
  VT(head, move(tail)...);
}
void VT2() {}
template <class Head, class... Tail>
void VT2(Head&& head, Tail&&... tail) {
  for (auto& youso_ : (head)) cin >> youso_;
  VT2(move(tail)...);
}
template <class Head>
void VT3(Head&& head) {}
template <class Head, class Seco, class... Tail>
void VT3(Head&& head, Seco&& seco, Tail&&... tail) {
  seco[head] = IN();
  VT3(head, move(tail)...);
}
int main() {
  int n;
  CINT(n);
  vector<long long> a;
  VT(n, a);
  VT2(a);
  ;
  map<long long, long long> m;
  for (int i = 0; i < (n); ++i) m[a[i]]++;
  if (m[0])
    if (1) {
      cout << "0" << endl;
      return 0;
    };
  for (auto&(xx) : (m))
    if (xx.second > 2)
      if (1) {
        cout << "0" << endl;
        return 0;
      };
  sort((a).begin(), (a).end());
  bitset<25> bs;
  bs[0] = true;
  bs[24] = true;
  for (int i = 0; i < (n); ++i) bs[(i & 1 ? a[i] : 24 - a[i])] = true;
  int count = 0;
  int ans = INF;
  for (int i = 0; i < (25); ++i) {
    if (!bs[i])
      count++;
    else {
      if (count) ans = min(ans, count + 1);
      count = 0;
    }
  }
  cout << (ans) << endl;
  return 0;
}
