#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[93], b[93];
  scanf("%d", &n);
  int ans = 0;
  a[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i - 1] = a[i] - a[i - 1];
  }
  b[n] = 90 - a[n];
  for (int i = 0; i <= n; i++) {
    if (b[i] > 15) {
      ans = a[i] + 15;
      break;
    }
  }
  if (!ans) ans = 90;
  printf("%d\n", ans);
  return 0;
}
