#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, A[100];
  cin >> n;
  int aux = 0, ans = 15;
  while (n--) {
    int t;
    cin >> t;
    if (t <= ans)
      ans = t + 15;
    else
      break;
  }
  if (ans > 90) ans = 90;
  cout << ans;
  return 0;
}
