#include <bits/stdc++.h>
int main() {
  int time, cnt, num, i, j;
  scanf("%d", &num);
  int *interesting = (int *)malloc(sizeof(int) * num);
  for (i = 0; i < num; i++) {
    scanf("%d", &interesting[i]);
  }
  time = 0;
  cnt = 0;
  j = 0;
  for (i = 0; i < 90; i++) {
    time++;
    cnt++;
    if (time == interesting[j]) {
      j++;
      cnt = 0;
    }
    if (cnt == 15) break;
  }
  printf("%d\n", time);
  free(interesting);
  return 0;
}
