#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 cnt1 = 0;
  while (a[1] == 0) {
    cnt1++;
    for (int i = 1; i <= n; i++) {
      a[i] = a[i + 1];
    }
    n--;
    if (n == 0) {
      break;
    }
  }
  if (cnt1 > 1) {
    printf("0\n");
  } else {
    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;
}
