#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int N;
int D[100];

int dp[100][30][30];
int solve(int i, int l, int r) {
  int &res = dp[i][l][r];
  if (res != -1) {
    return res;
  }
  if (i >= N) {
    return res = r - l;
  }
  // left
  res = max(res, min(D[i] - l, solve(i + 1, D[i], r)));
  // right
  res = max(res, min(r - (24 - D[i]), solve(i + 1, l, 24 - D[i])));
  return res;
}

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> D[i];
  }
  sort(D, D + N);
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, 24) << endl;
  return 0;
}
