#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 <= n; i++) {
    for (int j = 1; j <= i; j++) {
      if (j % 2 == 0) {
        b[j] = 1;
      } else {
        b[j] = 0;
      }
    }
    for (int j = i + 1; j <= n; j++) {
      if (j % 2 == 0) {
        b[j] = 0;
      } else {
        b[j] = 1;
      }
    }
    int last0 = 0, last1 = 0, min1 = 0, max0 = 0, mins = MAX_INF;
    for (int j = 1; j <= n; j++) {
      if (b[j] == 0) {
        if (last0 != 0) {
          int tmp = a[j] - a[last0];
          if (tmp < mins) {
            mins = tmp;
          }
        }
        last0 = j;
        max0 = a[j];
      } else {
        if (last1 != 0) {
          int tmp = a[j] - a[last1];
          if (tmp < mins) {
            mins = tmp;
          }
        }
        last1 = j;
        min1 = 24 - a[j];
      }
    }
    if ((min1) && (max0) && (min1 - max0 < mins)) {
      mins = min1 - max0;
    }
    if (mins > ans) {
      ans = mins;
    }
  }
  if (ans == MAX_INF) {
    ans = 0;
  }
  printf("%d\n", ans);
  return 0;
}
