#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v, a, b;
  map<int, int> mp;
  int n, m;
  int cnt = 15;
  cin >> n;
  while (n--) {
    cin >> m;
    if (m <= cnt) {
      cnt = m + 15;
    }
  }
  if (cnt > 90) cnt = 90;
  cout << cnt << endl;
}
