#include <bits/stdc++.h>
int N;
std::vector<int> D;
bool check(int num) {
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      if (abs(D[i] - D[j]) >= num || abs((24 - D[i]) - D[j]) >= num ||
          abs(D[i] - (24 - D[j])) >= num ||
          abs((24 - D[i]) - abs(24 - D[j])) >= num) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  std::cin >> N;
  D.resize(N);
  for (int i = 0; i < N; ++i) {
    std::cin >> D[i];
  }
  int l = 0, r = 24;
  while ((r - l) > 1) {
    int m = (l + r) / 2;
    if (check(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  std::cout << l << std::endl;
  return 0;
}
