#include <bits/stdc++.h>
using namespace std;
int a[100];
int main() {
  int n;
  cin >> n;
  a[0] = 0;
  for (int i = 1; i <= n; i++) scanf("%i", &a[i]);
  a[n + 1] = 90;
  a[n + 2] = 120;
  int k = 0;
  while (a[k + 1] - a[k] <= 15) k++;
  if (k != n + 1)
    printf("%i\n", a[k] + 15);
  else
    printf("90\n");
  return 0;
}
