#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e12;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  n++;
  vector<long long> d(n);
  d[0] = 0;
  for (long long i = 1; i < n; i++) cin >> d[i];
  sort(d.begin(), d.end());
  vector<vector<long long> > e(2, vector<long long>(n));
  e[0][0] = 0;
  e[1][0] = 0;
  for (long long i = 1; i < n; i++) {
    e[0][i] = d[i];
    e[1][i] = 24 - d[i];
  }
  long long ans = INF;
  long long dp[55][2] = {};
  for (long long i = 0; i < 55; i++)
    for (long long j = 0; j < 2; j++) dp[i][j] = 0;
  dp[0][0] = INF;
  dp[0][1] = INF;
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < 2; j++) {
      for (long long k = 0; k < 2; k++) {
        dp[i][j] = max(dp[i][j], min(dp[i - 1][k], abs(e[j][i] - e[k][i - 1])));
      }
    }
  }
  ans = max(dp[n - 1][0], dp[n - 1][1]);
  if (ans == 24) ans = 0;
  cout << ans << endl;
}
