#include <bits/stdc++.h>
using namespace std;
int a[100];
int n;
bool pan(int m) {
  for (int i = 0; i <= n; i++) {
    int k = a[i];
    for (int j = 0; j <= n; j++) {
      if (i == j) continue;
      if (a[i] + a[j] >= 24) continue;
      if (a[i] + a[j] + m >= 24) return false;
    }
    k = 24 - a[i];
    for (int j = 0; j <= n; j++) {
      if (i == j) continue;
      if (a[i] + a[j] >= 24) continue;
      if (a[i] + a[j] + m >= 24) return false;
    }
  }
  return true;
}
int main() {
  cin >> n;
  a[0] = 0;
  for (register int i = 1; i <= n; ++i) cin >> a[i];
  int l = 0, r = 24;
  while (l < r) {
    int m = (l + r) / 2;
    if (pan(m))
      l = m + 1;
    else
      r = m;
  }
  if (l >= 12) l = 24 - l;
  cout << l << endl;
  return 0;
}
