#include <bits/stdc++.h>
double EPS = 1e-9;
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
long long int MOD = 1000000007;
int n;
bool used[350];
int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  int cnt[15] = {0};
  for (int i = 0; i < N; i++) {
    cin >> d[i];
    cnt[d[i]]++;
  }
  cnt[0]++;
  bool flag = true;
  for (int i = 0; i <= 12; i++) {
    if (cnt[i] >= 3) flag = false;
  }
  if (flag) {
    if (N > 11) {
      cout << "1" << endl;
    } else {
      int ma = 0;
      for (int i = 0; i < (1 << N); i++) {
        vector<int> nums;
        nums.push_back(0);
        int hoge = i;
        for (int j = 0; j < N; j++) {
          if (hoge % 2 == 0) {
            nums.push_back(d[j]);
          } else {
            nums.push_back(24 - d[j]);
          }
          hoge = hoge / 2;
        }
        sort(nums.begin(), nums.end());
        int mi = 24;
        nums.push_back(24);
        for (int k = 0; k < N + 1; k++) {
          mi = min(mi, nums[k + 1] - nums[k]);
        }
        ma = max(ma, mi);
      }
      cout << ma << endl;
    }
  } else {
    cout << "0" << endl;
  }
}
