#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int n, m, t = 0;
char s[100005];
int a[100], b[100];
int MIN = 24, MAX = 24;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    if (i % 2 == 0)
      b[i] = 24 - a[i];
    else
      b[i] = a[i];
  }
  sort(b, b + n);
  for (int i = 1; i < n; i++) {
    if (b[i] - b[i - 1] < MIN) MIN = b[i] - b[i - 1];
  }
  printf("%d\n", MIN);
  return 0;
}
