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