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