#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n == 0) {
    cout << n << endl;
    return 0;
  }
  int cur1 = 0, cur2;
  for (int i = 0; i < n; ++i) {
    cur2 = cur1;
    cin >> cur1;
    if (cur1 - cur2 > 15) {
      cout << min(cur2 + 15, 90) << endl;
      return 0;
    }
  }
  cout << min(cur1 + 15, 90) << endl;
  return 0;
}
