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