#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int last = 0, in;
  while (n--) {
    cin >> in;
    if (in - last > 15) break;
    last = in;
  }
  int ans = min(last + 15, 90);
  cout << ans << endl;
  return 0;
}
