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