#include <bits/stdc++.h>
using namespace std;
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> D(N);
  for (int i = (0); i < (N); i++) {
    cin >> D[i];
  }
  sort(begin(D), end(D));
  int prev = 0;
  int cur = 0;
  do {
    prev = cur;
    cur = 24 - D.back();
    for (int i = (0); i < (N - 1); i++) {
      chmin(cur, D[i + 1] - D[i]);
    }
  } while (cur > prev);
  cout << cur << endl;
  return 0;
}
