#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int d[100] = {0};
  for (int i = 1; i <= n; i++) cin >> d[i];
  int ans = *min_element(d + 1, d + n + 1);
  if (n == 1) return cout << ans << endl, 0;
  if (n == 2) {
    int tmp1 = abs(d[1] - d[2]);
    int tmp2 = abs(d[1] - 24 + d[2]);
    ans = min(ans, max(tmp1, tmp2));
    return cout << ans << endl, 0;
  }
  int tmp = 0;
  sort(d + 1, d + 1 + n);
  for (int i = 2; i <= n; i++) {
    tmp = max(tmp, d[i] - d[i - 1]);
  }
  cout << min(tmp, ans) << endl;
  return 0;
}
