#include <bits/stdc++.h>
using namespace std;
int t[95];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  t[0] = 0;
  int langkah;
  langkah = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    a = t[i] - t[i - 1];
    if (a <= 15)
      langkah++;
    else {
      break;
    }
  }
  if (t[langkah] + 15 >= 90)
    cout << 90 << endl;
  else {
    cout << t[langkah] + 15 << endl;
  }
  return 0;
}
