#include <bits/stdc++.h>
using namespace std;
long long bgm(long long a, long long b, long long m) {
  a %= m;
  long long rem = 1;
  while (b) {
    if (b & 1) rem = (rem * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return rem;
}
long long inv(long long a, long long mod) { return bgm(a, mod - 2, mod); }
long long in() {
  long long a;
  assert(scanf("%lld", &a) != EOF);
  return a;
}
double dl() {
  double a;
  assert(scanf("%lf", &a) != EOF);
  return a;
}
const int MAX = 100005;
const long long MOD = 1000000007;
int n;
int ara[100];
int f = 1;
int ans = 90;
int main() {
  n = in();
  for (int i = 1; i <= n; i++) ara[i] = in();
  ara[++n] = 90;
  for (int i = 1; f and i <= n; i++)
    if (ara[i] > ara[i - 1] + 15) ans = ara[i - 1] + 15, f = 0;
  printf("%lld", (long long)(ans)), puts("");
  return 0;
}
