#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void test_case() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &x : a) cin >> x;
  int l = 0;
  for (int i = 0; i < n; i++) {
    if (abs(l - a[i]) > 15) {
      cout << l + 15;
      return;
    }
    l = a[i];
  }
  if (l > 75)
    cout << 90;
  else
    cout << l + 15;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) test_case();
}
