#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num, sum, prev, flag;
  cin >> n;
  sum = prev = flag = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    if (num - prev > 15 && flag == 0) {
      flag = 1;
      sum = prev + 15;
    }
    if (flag == 0) {
      sum = num;
      prev = num;
    }
  }
  if (90 - prev > 15)
    sum = prev + 15;
  else
    sum = 90;
  cout << sum << "\n";
  return 0;
}
