#include <bits/stdc++.h>
using namespace std;
long long n, a[60];
signed main() {
  cin >> n;
  for (long long i = 1; i <= (n); i++) cin >> a[i];
  sort(a, a + n + 1);
  if (a[1] == 0) {
    cout << "0\n";
    return 0;
  }
  for (long long i = 1; i <= n; i += 2) a[i] = 24 - a[i];
  sort(a, a + n + 1);
  long long ans = 24;
  for (long long i = 1; i <= (n); i++) ans = min(ans, a[i] - a[i - 1]);
  cout << ans << endl;
}
