#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, hold, d, ans;
  cin >> n >> hold;
  bool flag = 0, lol = 0;
  if (hold > 15) {
    flag = 1;
  } else if (n == 1) {
    ans = hold + 15;
  }
  for (int i = 1; i < n; i++) {
    cin >> d;
    if (d - hold > 15) {
      ans = hold + 15;
    } else {
      hold = d;
      if (i == n - 1) {
        ans = hold + 15;
      }
      if (d > 74) {
        lol = 1;
      }
    }
  }
  if (flag) {
    cout << 15 << endl;
  } else if (lol) {
    cout << 90 << endl;
  } else {
    cout << ans << endl;
  }
}
