#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int t[n];
  t[0] = 0;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++)
    if (t[i] - t[i - 1] <= 15) {
      if (i == n) {
        if (t[i] >= 75)
          cout << 90 << endl;
        else
          cout << t[i] + 15 << endl;
      } else
        continue;
    } else {
      cout << t[i - 1] + 15;
      break;
    }
}
