#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e9 + 7;
int main() {
  vector<int> v;
  v.push_back(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(t);
  }
  bool b = 1;
  for (int i = 1; i <= n; i++) {
    if ((v[i] - v[i - 1]) > 15) {
      cout << v[i - 1] + 15;
      b = 0;
      return 0;
    }
  }
  if (b) {
    cout << min(v[(v.size() - 1)] + 15, 90);
  }
}
