#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int buf = 0;
  for (int i = 0; i < (int)n; i++) {
    int a;
    cin >> a;
    if (buf + 15 < a) {
      cout << buf + 15 << endl;
      return 0;
    } else {
      buf = a;
    }
  }
  if (buf + 15 > 90) {
    cout << 90 << endl;
  } else {
    cout << buf + 15 << endl;
  }
  return 0;
}
