#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]);
    }
    MAX = 24;
    MAX = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 2; j++) {
        int MIN = 24;
        for (int k = 0; k < n; k++) {
          if (k == i) continue;
          if (j == 0) {
            t1 = fabs(a[j] - a[k]);
          } else
            t1 = fabs(24 - a[j] - a[k]);
          MIN = min(t1, MIN);
        }
        MAX = max(MAX, MIN);
      }
    }
    if (n == 1) MAX = 0;
    printf("%d\n", MAX);
  }
}
