2
1 18
 9
6 20 27 28 40 53 59 70 85
 8
10 20 30 40 50 60 70 80
 6
13 17 32 47 60 66
 1
1
 8
5 17 20 35 42 53 67 76
 1
90
 6
14 29 43 59 70 74
 76
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
 8
15 20 30 40 50 60 73 83
 14
14 22 27 31 35 44 46 61 62 69 74 79 88 89
 30
6 11 12 15 22 24 30 31 32 33 34 35 40 42 44 45 47 50 53 54 57 58 63 67 75 77 79 81 83 88
 84
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
 6
15 30 45 60 74 89
 9
15 28 39 48 55 60 63 64 74
 1
15
 9
10 20 30 40 50 60 70 80 84
 25
1 2 3 4 5 6 7 8 9 10 11 23 36 50 65 81 82 83 84 85 86 87 88 89 90
 5
15 30 45 60 74
 2
16 50
 12
14 22 27 31 35 44 62 69 74 79 88 89
 10
15 28 39 48 55 60 63 64 74 82
 60
1 2 4 5 6 7 11 14 16 18 20 21 22 23 24 25 26 33 34 35 36 37 38 39 41 42 43 44 46 47 48 49 52 55 56 57 58 59 60 61 63 64 65 67 68 70 71 72 73 74 75 77 78 80 82 83 84 85 86 88
 6
15 30 45 60 75 84
 90
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
 3
1 20 90
 8
1 16 30 31 32 33 34 50
 72
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
 12
1 3 6 10 15 21 28 36 45 55 66 78
 1
16
 5
15 30 45 60 75

16
 90
 90
 81
 16
 90
 15
 58
 90
 90
 90
 90
 90
 90
 89
 30
 90
 80
 89
 15
 59
 90
 90
 90
 90
 16
 49
 54
 90
 15
 90

#include <bits/stdc++.h>
using namespace std;
template <class T>
const T& max(const T& a, const T& b, const T& c) {
  return max(a, max(b, c));
}
template <class T>
const T& min(const T& a, const T& b, const T& c) {
  return min(a, min(b, c));
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long tmp = poww(a, b / 2);
  return (b & 1 ? a * tmp * tmp : tmp * tmp);
}
double poww(double a, int b) {
  if (b == 0) return 1;
  double tmp = poww(a, b / 2);
  return (b & 1 ? a * tmp * tmp : tmp * tmp);
}
long long sumOfDigs(string s) {
  long long sum = 0;
  for (int i = 0; i < s.length(); i++) sum += s[i] - '0';
  return sum;
}
long long sumOfDigs(long long n) {
  return (n < 10 ? n : n % 10 + sumOfDigs(n / 10));
}
string itos(long long i) {
  string s = "";
  while (i) {
    s += char(i % 10 + '0');
    i /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
long long stoi(string& s) {
  long long tot = 0;
  for (int i = (int)s.length() - 1, j = 1; i >= 0; i--, j *= 10) {
    tot += j * (s[i] - '0');
  }
  return tot;
}
long long mod = poww(10, 6) + 3;
int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
using namespace std;
void t() { freopen("test.txt", "r", stdin); }
bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
  return a.second < b.second;
}
int a[1000];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int curr = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] - curr > 15) {
      return cout << (curr + 15) << endl, 0;
    } else
      curr = a[i];
  }
  if (curr + 15 > 90)
    return cout << 90 << endl, 0;
  else
    return cout << curr + 15 << endl, 0;
  return 0;
}
