#include <bits/stdc++.h>
int a[50];
using namespace std;
int main() {
  int n, t;
  int MAX, MIN, t1, t2;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    MIN = 24;
    for (int j = 0; j < n; j++)
      for (int k = j + 1; k < n; k++) {
        t1 = fabs(a[j] - a[k]);
        t2 = fabs(24 - a[j] - a[k]);
        MIN = min(MIN, max(t1, t2));
      }
    if (n == 1) MIN = 0;
    printf("%d\n", MIN);
  }
}
