#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  int a = 0, b;
  for (int i = 0; i < n; i++) {
    if (A[i] - a > 15) {
      cout << (a + 15) << endl;
      return 0;
    }
    a = A[i];
  }
  cout << min(90, a + 15) << endl;
}
