#include <bits/stdc++.h>
using namespace std;
template <typename X>
bool exist(vector<X> vec, X item) {
  return find(vec.begin(), vec.end(), item) != vec.end();
}
long long N;
vector<long long> D;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (long long i = (long long)0; i < (long long)N; i++) {
    long long inp;
    cin >> inp;
    D.push_back(inp);
    if (inp == 0) {
      cout << "0" << endl;
      return 0;
    }
  }
  if (N == 1) {
    cout << D[0] << endl;
    return 0;
  }
  sort(D.rbegin(), D.rend());
  cout << 24 - D[0] - D[1] << endl;
  return 0;
}
