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