#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const int MAX = 400002;
int N;
int a[MAX];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> a[i];
  sort(a + 1, a + 1 + N);
  for (int i = 1; i <= N; i++) {
    if (i % 2 == 0) {
      a[i] = 24 - a[i];
    }
  }
  sort(a + 1, a + 1 + N);
  int maxn = 25;
  for (int i = 2; i <= N; i++) {
    maxn = min(maxn, a[i] - a[i - 1]);
  }
  cout << maxn << endl;
  return 0;
}
