#include <bits/stdc++.h>
using namespace std;
int L01P08(vector<int>& arr, int n) {
  bool check = true;
  if (arr[0] - 15 > 0) {
    return 15;
  } else {
    for (int i = 0; i < n - 1; i++) {
      for (int j = 1; j < n; j++) {
        if (arr[i] + 15 < arr[i + 1]) {
          return arr[i] + 15;
          break;
        }
      }
    }
    if (arr[arr.size() - 1] + 15 < 90) {
      return arr[arr.size() - 1] + 15;
    } else {
      return 90;
    }
  }
}
int main() {
  int n, val;
  cin >> n;
  vector<int> arr;
  for (int i = 0; i < n; i++) {
    cin >> val;
    arr.push_back(val);
  }
  int res = L01P08(arr, n);
  cout << res;
  return 0;
}
