#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, last;
  string line;
  while (cin >> n) {
    last = 0;
    cin.ignore(0x7fffffff, '\n');
    getline(cin, line);
    istringstream intIn(line);
    while (n--) {
      intIn >> m;
      if (last + 15 < m) break;
      last = m;
    }
    if (last + 15 >= 90)
      cout << 90 << endl;
    else
      cout << last + 15 << endl;
  }
  return 0;
}
