#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, num, arr[100], c = 0, flag = 0;
  cin >> num;
  arr[0] = 0;
  for (int j = 1; j <= num; j++) cin >> arr[j];
  for (i = 0; i < num; i++) {
    c = arr[i + 1] - arr[i];
    if (c > 15) {
      flag = 1;
      cout << arr[i] + 15 << endl;
      break;
    }
  }
  if (flag == 0) {
    if (arr[i] <= 75)
      cout << arr[i] + 15 << endl;
    else
      cout << "90" << endl;
  }
  return 0;
}
