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