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