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