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