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