#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int aux = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x - aux > 15) {
      cout << min(90, 15 + aux) << '\n';
      return 0;
    } else
      ans += x;
    aux = x;
  }
  cout << min(90, 15 + aux) << '\n';
}
