#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100], n, i, sum = 0, br = 0, j = 1;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= 90; i++) {
    br++;
    if (br > 15) {
      cout << a[j - 1] + 15 << endl;
      return 0;
    }
    if (i == a[j]) {
      sum = a[j];
      j++;
      br = 0;
    }
  }
  cout << 90 << endl;
  return 0;
}
