#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10240000")
using namespace std;
const int MAXN = 110;
const int MAX_INF = 0x3fffffff;
int a[MAXN], b[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + n + 1);
  int mins = MAX_INF;
  for (int i = 2; i <= n; i++) {
    int tmp = a[i] - a[i - 1];
    if (tmp < mins) {
      mins = tmp;
    }
  }
  int ans = mins;
  for (int i = 0; i <= 1; i++) {
    int mins = MAX_INF;
    for (int j = 1; j <= n; j++) {
      if (j % 2 == i) {
        b[j] = a[j];
      } else {
        b[j] = 24 - a[j];
      }
    }
    sort(b + 1, b + n + 1);
    for (int j = 2; j <= n; j++) {
      int tmp = b[j] - b[j - 1];
      if (tmp < mins) {
        mins = tmp;
      }
    }
    if (mins > ans) {
      ans = mins;
    }
  }
  if (ans == MAX_INF) {
    ans = 0;
  }
  printf("%d\n", ans);
  return 0;
}
