#include <bits/stdc++.h>
int main() {
  int n;
  std::vector<int> v;
  std::cin >> n;
  int width = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    std::cin >> temp;
    v.push_back(temp);
  }
  int watching = 0;
  int boring = 15;
  for (int i = 0; i < n; i++) {
    watching = v[i];
    if (watching > boring) {
      std::cout << boring;
      return 0;
    }
    if (watching <= boring) {
      boring = watching + 15;
    }
  }
  watching += 15;
  if (watching > 90) {
    std::cout << 90;
    return 0;
  }
  std::cout << watching;
}
