#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, expectedNext = 15;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    if (tmp <= expectedNext) {
      expectedNext = tmp += 15;
    } else {
      break;
    }
  }
  if (expectedNext > 90) {
    expectedNext = 90;
  }
  cout << expectedNext;
}
