#include <bits/stdc++.h>
int main() {
  int n, i, j;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  if (n == 1) {
    if (a[0] < 16)
      printf("%d\n", a[0] + 15);
    else
      printf("15\n");
  } else {
    int c = 0, b[n];
    for (i = 0; i < n; i++) {
      b[i] = a[i] - c;
      c = a[i];
    }
    int d = n - 1;
    for (i = 0; i < n; i++) {
      if (b[i] > 15) {
        d = i - 1;
        break;
      }
    }
    if (d >= 0) {
      if (a[d] + 15 <= 90)
        printf("%d\n", a[d] + 15);
      else
        printf("90\n");
    } else
      printf("15\n");
  }
}
