Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.

Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.

You know that there will be n interesting minutes t_1, t_2, ..., t_{n}. Your task is to calculate for how many minutes Limak will watch the game.


-----Input-----

The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes.

The second line contains n integers t_1, t_2, ..., t_{n} (1 ≤ t_1 < t_2 < ... t_{n} ≤ 90), given in the increasing order.


-----Output-----

Print the number of minutes Limak will watch the game.


-----Examples-----
Input
3
7 20 88

Output
35

Input
9
16 20 30 40 50 60 70 80 90

Output
15

Input
9
15 20 30 40 50 60 70 80 90

Output
90



-----Note-----

In the first sample, minutes 21, 22, ..., 35 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.

In the second sample, the first 15 minutes are boring.

In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = int(input())
a = list(map(int, input().split()))
s = a[0]
count = 0
if a[0] > 15:
	print(15)
else:
	i = 0
	while i <= n - 1:
		if i == n - 1:
			if a[i] + 15 < 90:
				count = a[i] + 15
			else:
				count = 90
			break
		elif a[i + 1] - a[i] > 15:
			count = a[i] + 15
			break
		else:
			count = a[i]
		i += 1
	print(count)


numberOfMoment = input()
listOfMoment = input().split()
sleepAt = 0
for (index, moment) in enumerate(listOfMoment):
	if int(moment) - sleepAt > 15:
		sleepAt += 15
		break
	else:
		sleepAt = int(moment)
	if index == len(listOfMoment) - 1:
		sleepAt = min(sleepAt + 15, 90)
print(sleepAt)


n = int(input())
minutes = list(map(int, input().split()))
start_minute = 1
end_minute = 90
if n <= 1:
	length = minutes[0] - start_minute
	if length >= 15:
		print(15)
	else:
		print(minutes[0] + 15)
else:
	for i in range(n):
		if i == 0:
			length = minutes[i] - start_minute
			if length >= 15:
				print(15)
				exit()
		else:
			length = minutes[i] - minutes[i - 1]
			if length > 15:
				print(minutes[i - 1] + 15)
				exit()
	if end_minute - minutes[-1] < 15:
		print(90)
	else:
		print(minutes[-1] + 15)


def interesting(lst):
	if lst[0] > 15:
		return 15
	s = 0
	for i in range(1, len(lst)):
		if lst[i] - lst[i - 1] > 15:
			return 15 + lst[i - 1]
	return min(90, lst[-1] + 15)
n = int(input())
a = [int(j) for j in input().split()]
print(interesting(a))


x = int(input())
a = list(map(int, input().split()))
i = 0
p = 15
while i < x:
	if a[i] > p:
		exit(print(p))
	else:
		p = 15 + a[i]
	i += 1
print(min(a[-1] + 15, 90))


n = int(input())
moment = list(map(int, input().split()))

def stupid_bear(a):
	ans = 0
	for i in range(len(a)):
		if i == 0:
			if a[i] > 15:
				ans = 15
				break
		else:
			if a[i] - a[i - 1] > 15:
				ans = a[i - 1] + 15
				break
			if a[i] - a[i - 1] <= 15:
				ans = a[i]
	return ans
moment.append(90)
print(stupid_bear(moment))


n = int(input())
a = list(map(int, input().split()))
last = 0
cnt = 0
for i in range(1, 91):
	if i - last > 15:
		break
	cnt += 1
	if i in a:
		last = i
print(cnt)


n = int(input())
l = []
l.extend(map(int, input().split()))
x = 0
for i in l:
	if x + 15 >= i:
		x = i
	else:
		break
print(min(90, x + 15))


a = int(input())
b = [0] + list(map(int, input().split())) + [90]
for i in range(a + 1):
	if b[i + 1] - b[i] > 15:
		print(b[i] + 15)
		exit()
print(90)


n = int(input())
lst = list(map(int, input().split()))
free = [False] * 91
for x in lst:
	free[x] = True
not_false = 0
for i in range(1, len(free)):
	if free[i]:
		not_false = i
	elif abs(i - not_false) >= 15:
		print(i)
		return
print(90)


input()
ts = map(int, input().split())
time = 15
for t in ts:
	if t <= time:
		time = t + 15
	else:
		break
print(min(90, time))


n = int(input())
a = map(int, input().split())
b = [False for i in range(90)]
for i in a:
	b[i - 1] = True
(res, cnt) = (0, 0)
for i in range(90):
	res += 1
	if b[i] == False:
		cnt += 1
		if cnt == 15:
			break
	else:
		cnt = 0
print(res)


n = int(input())
ti = map(int, input().split())
t2 = [0] * 91
for i in ti:
	t2[i] = 1
num = 0
ans = 0
for i in range(1, 91):
	if t2[i] == 0:
		num += 1
	else:
		num = 0
	ans = i
	if num >= 15:
		break
print(ans)


n = int(input())
numbers = [int(i) for i in input().split()]
dur = 15
if n == 0 or numbers[0] > 15:
	print(dur)
else:
	for i in range(0, n):
		if dur >= numbers[i]:
			dur = numbers[i] + 15
		else:
			break
	if dur < 90:
		print(dur)
	else:
		print(90)


input()
mins = map(int, input().split(' '))
max_min = 15
for minute in mins:
	if minute <= max_min:
		max_min = minute + 15
	else:
		break
print(min(max_min, 90))


n = int(input()) + 2
a = [0]
a.extend(list(map(int, input().split())))
a.append(90)
ans = 0
for i in range(1, n):
	if a[i] - a[i - 1] > 15:
		ans += 15
		break
	else:
		ans = a[i]
print(ans)


n = int(input())
t = list(map(int, input().split()))
t = [0] + t + [90]
for i in range(len(t) - 1):
	if t[i + 1] - t[i] - 1 >= 15:
		print(t[i] + 15)
		exit()
print(90)


number_of_good = int(input())
good_mins = input()
good_mins = good_mins.split(' ')
good_mins.append('90')
if int(good_mins[0]) > 15:
	print(15)
	exit()
for i in range(1, len(good_mins)):
	if int(good_mins[i]) - int(good_mins[i - 1]) > 15:
		print(int(good_mins[i - 1]) + 15)
		exit()
print(90)


n = int(input())
l = list(map(int, input().split()))
if l[0] > 15:
	print(15)
elif l[0] <= 15 and n == 1:
	print(l[0] + 15)
else:
	f = 0
	l.append(90)
	for i in range(1, n + 1):
		if l[i] - l[i - 1] > 15:
			s = l[i - 1] + 15
			f = 1
			break
		else:
			continue
	if f == 0:
		print(90)
	else:
		print(s)


n = int(input())
mi = list(map(int, input().split()))
mi.insert(0, 0)
ans = 0
i = 0
try:
	while mi[i + 1] - mi[i] <= 15:
		ans = mi[i + 1]
		i = i + 1
	print(ans + 15)
except:
	if mi[-1] + 15 >= 90:
		print(90)
	else:
		print(mi[-1] + 15)


def process(arr, n):
	for i in range(1, n + 1):
		if arr[i] - arr[i - 1] > 15:
			return arr[i - 1] + 15
	arr[n] += 15
	return arr[n] if arr[n] < 90 else 90

def main():
	n = int(input())
	arr = [0]
	for i in input().split():
		arr.append(int(i))
	print(process(arr, n))
main()


n = int(input())
l = list(map(int, input().split()))
last_interesting = 0
_min = 0
l.append(100000)
for i in l:
	if i - last_interesting > 15:
		_min += 15
		break
	_min += i - last_interesting
	last_interesting = i
print(min(_min, 90))


n = int(input())
v = list(map(int, input().split()))
boring = 0
for i in range(1, 91):
	boring += 1
	if i in v:
		boring = 0
	if boring == 15:
		print(i)
		exit(0)
print(90)


import sys
number_of_minutes = int(input())
time_range = input()
minutes = time_range.split()
tmp = 0
for i in range(number_of_minutes):
	if int(tmp) + 15 < int(minutes[i]):
		print(str(int(tmp) + 15))
		sys.exit()
	tmp = minutes[i]
if int(tmp) + 15 > 90:
	print('90')
else:
	print(str(int(tmp) + 15))


n = int(input())
arr = list(map(int, input().split(' ')))
last = 0
end = False
for i in arr:
	if i - last > 15:
		print(last + 15)
		end = True
		break
	last = i
if not end:
	if last > 74:
		print(90)
	else:
		print(last + 15)


def main():
	N = int(input())
	arr = list(map(int, input().split()))
	start = 0
	flag = True
	index = -1
	for i in range(len(arr)):
		if arr[i] - start > 15:
			flag = False
			index = i
			break
		start = arr[i]
	if flag:
		if 90 - arr[-1] >= 15:
			print(arr[-1] + 15)
		else:
			print(90)
	elif index - 1 >= 0:
		print(arr[index - 1] + 15)
	else:
		print(15)
main()


n = int(input())
x = 0
j = 15
t = True
a = list(map(int, input().strip().split()))[:n]
for i in range(0, len(a)):
	if a[i] > j:
		t = False
	if t:
		j = a[i] + 15
if j > 90:
	j = 90
print(j)


from sys import stdin
n = int(input())
arr = list(map(int, stdin.readline().split()))
cnt = 0
for i in range(n):
	if i == 0 and arr[i] <= 15:
		cnt = arr[i] + 15
	elif i == 0 and arr[i] > 15:
		cnt = 15
		break
	elif arr[i] <= cnt:
		cnt = arr[i] + 15
		if cnt > 90:
			cnt = 90
	else:
		break
print(cnt)


n = int(input())
array = list(map(int, input().split()))
first = array[0]
last = array[n - 1]
sum = first
if first > 15:
	print(15)
	exit(0)
for i in range(1, n):
	if array[i] - array[i - 1] > 15:
		print(array[i - 1] + 15)
		exit(0)
sum = array[n - 1] + 15
if sum > 90:
	sum = 90
print(sum)


i = input
i()
l = 0
for x in map(int, input().split()):
	if x > l + 15:
		break
	l = x
print(min(90, l + 15))


def calculate_interesting_minutes(minutes_list):
	minutes_list.insert(0, 0)
	interesting_minutes = 0
	for i in range(len(minutes_list) - 1):
		if minutes_list[i + 1] - minutes_list[i] > 15:
			interesting_minutes = 15 + minutes_list[i]
			break
	else:
		interesting_minutes = 15 + minutes_list[i + 1]
	if interesting_minutes >= 90:
		interesting_minutes = 90
	return interesting_minutes
n = int(input())
minutes_list = list(map(int, input().split()))
print(calculate_interesting_minutes(minutes_list))


n = int(input())
t = list(map(int, input().split()))
r = 0
if t[0] > 15:
	print(15)
elif len(t) == 1:
	print(t[0] + 15)
else:
	s = 0
	for i in range(n - 1):
		if t[i + 1] - t[i] > 15:
			print(t[i] + 15)
			break
		else:
			s += 1
	if s == len(t) - 1:
		if 90 - t[-1] > 15:
			print(t[-1] + 15)
		else:
			print(90)


n = int(input())
a = [int(i) for i in input().split()]
ch = 0
for f in a:
	if f - ch > 15:
		break
	else:
		ch = f
if ch >= 90 - 15:
	ch = 90
else:
	ch += 15
print(ch)


n = int(input())
arr = list(map(int, input().split()))
arr.append(90)
arr.insert(0, 0)

def truncate(x):
	if x > 90:
		return 90
	if x == 0:
		return 90
	return x
res = 0
for i in range(n + 1):
	if arr[i + 1] - arr[i] > 15:
		res = arr[i] + 15
		break
print(truncate(res))


input()
s = 0
for i in map(int, input().split()):
	if i - s > 15:
		break
	else:
		s = i
print(min(s + 15, 90))


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
for i in range(1, n + 1):
	if l[i] - l[i - 1] > 15:
		print(l[i - 1] + 15)
		exit()
else:
	print(min(90, l.pop() + 15))


n = int(input())
L = [int(x) for x in input().split()]
ct = 0
for i in range(1, 91):
	if i in L:
		ct = 0
	else:
		ct += 1
		if ct == 15:
			break
if i == 91:
	i = 90
print(i)


input()
(*a,) = map(int, input().split())
ans = 0
for i in a:
	if i - ans > 15:
		break
	ans = i
print(ans + 15 if ans <= 75 else 90)


x = int(input())
s = list(map(int, input().split()))
e = 0
c = 0
for n in range(x):
	if n == 0:
		if s[n] > 15:
			e = e + 15
			c = 1
			break
		if s[n] <= 15:
			e = e + s[n]
			c = c
	elif n != 0:
		if s[n] - s[n - 1] <= 15:
			e = e + (s[n] - s[n - 1])
			c = c
		elif s[n] - s[n - 1] > 15:
			e = e + 15
			c = 1
			break
if s[x - 1] != 90 and c == 0:
	if 90 - s[x - 1] <= 15:
		e = e + 90 - s[x - 1]
		print(e)
	elif 90 - s[x - 1] > 15:
		e = e + 15
		print(e)
else:
	print(e)


n = int(input())
t = list(map(int, input().split()))
if n == 1 or t[0] > 15:
	if t[0] > 15:
		print(15)
	else:
		print(t[0] + 15)
else:
	watchtime = 0
	for i in range(1, n):
		if t[i] - t[i - 1] > 15:
			watchtime = t[i - 1] + 15
			break
	if watchtime == 0:
		watchtime = t[-1] + 15
	if watchtime > 90:
		print(90)
	else:
		print(watchtime)


n = int(input())
t = input().split()
current_time = 0
total_time = 0
for (idx, i) in enumerate(t):
	i = int(i)
	if i - current_time > 15:
		total_time += 15
		break
	else:
		total_time += i - current_time
	current_time = i
	if idx == n - 1:
		if i + 15 <= 90:
			total_time += 15
		else:
			total_time = 90
print(total_time)


mins_count = int(input())
mins_string = str(input())
mins_array = mins_string.split(' ')
mins_array.append(90)
count = 0
while count <= mins_count - 1:
	if count == 0 and int(mins_array[count]) - 0 > 15:
		print('15')
		break
	elif int(mins_array[count + 1]) - int(mins_array[count]) > 15:
		print(str(int(mins_array[count]) + 15))
		break
	elif count == mins_count - 1:
		print('90')
	count += 1


n = int(input())
val = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
	if val[i] > val[i - 1] + 15:
		print(val[i - 1] + 15)
		exit()
print(min(val[-1] + 15, 90))


n = int(input())
a = list(map(int, input().split()))
a.append(90)
a.insert(0, 0)
a.append(1000)
for i in range(1, len(a)):
	if a[i] - a[i - 1] > 15:
		print(min(90, a[i - 1] + 15))
		break


from math import *
l = int(input())
arr = map(int, input().split())
s = 15
for i in arr:
	if i > s:
		break
	else:
		s = i + 15
else:
	s = min(s, 90)
print(s)


def game(arr):
	if arr[0] > 15:
		return 15
	i = arr.pop(0)
	while arr:
		if arr[0] > i + 15:
			return i + 15
		i = arr.pop(0)
	return min(i + 15, 90)
n = int(input())
arr = list(map(int, input().split()))
print(game(arr))


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] <= 15:
		print(a[0] + 15)
		exit()
	else:
		print('15')
		exit()
for i in range(n - 1):
	if a[0] > 15:
		print('15')
		exit()
	elif a[i + 1] - a[i] > 15:
		print(a[i] + 15)
		exit()
print(min(90, a[-1] + 15))


n = input()
A = input()
A = list(map(int, A.split()))
A.insert(0, 0)
A.append(90)
result = 0
for (idx, item) in enumerate(A):
	x = item + 15
	if x >= 90:
		result = 90
		break
	if x < A[idx + 1]:
		result = x
		break
print(result)


def solve():
	n = int(input().strip())
	t = [0 for _ in range(n + 3)]
	t[0] = 0
	tmp = list(map(int, input().strip().split()))
	for i in range(n):
		t[i + 1] = tmp[i]
	t[n + 1] = 90
	for i in range(0, n + 1):
		if t[i + 1] - t[i] > 15:
			print(t[i] + 15)
			return
	print(90)
solve()


def main():
	input()
	num = [int(i) for i in input().split()]
	now = 0
	last = 0
	for i in num:
		last = now
		now = i
		if last + 15 < now:
			if last + 15 < 90:
				print(last + 15)
			else:
				print(90)
			return
	if now + 15 < 90:
		print(now + 15)
	else:
		print(90)
	return
main()


n = int(input())
a = list(map(int, input().split()))

def main():
	if a[0] > 15:
		print(15)
		return
	last_interval = a[0]
	i = 0
	while i < n:
		count = a[i] + 15
		if i + 1 >= n:
			last_interval = a[i]
			break
		if count < a[i + 1]:
			print(count)
			return
		i += 1
	if last_interval + 15 < 90:
		print(last_interval + 15)
	else:
		print(90)
	return
main()


line1 = input()
line2 = input()
tempt = [0] + line2.split(' ')
minute = int(tempt[-1])
for i in range(len(tempt) - 1):
	if int(tempt[i + 1]) - int(tempt[i]) > 15:
		minute = int(tempt[i])
		break
if minute + 15 > 90:
	print(90)
else:
	print(minute + 15)


n = int(input())
tl = list(map(int, input().split()))
time = cnt = 0
while cnt < 15 and time < 90:
	time += 1
	if tl.count(time) > 0:
		cnt = 0
	else:
		cnt += 1
print(time)


n = int(input())
a = list(map(int, input().split()))
ans = 0
if len(a) == 0:
	ans = 0
elif len(a) == 1:
	if a[0] >= 16:
		ans = 15
	else:
		ans = a[0] + 15
elif a[0] >= 16:
	ans = 15
else:
	for i in range(1, len(a)):
		if a[i] - a[i - 1] >= 16:
			ans = a[i - 1] + 15
			break
	if ans == 0:
		ans = a[-1] + 15
if ans == 0 or ans > 90:
	ans = 90
print(ans)


n = int(input())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
	if l[i] > ans + 15:
		break
	else:
		ans = l[i]
if ans > 75:
	print(90)
else:
	print(ans + 15)


number_of_interested_times = int(input())
interested_times = list(map(int, input().split()))
result = 0

def get_interested_time():
	if number_of_interested_times == 1:
		if interested_times[0] > 15:
			return 15
		else:
			return interested_times[0] + 15
	pre_intertesed_time = 0
	for interested_time in interested_times:
		if interested_time - pre_intertesed_time <= 15:
			pre_intertesed_time = interested_time
		else:
			pre_intertesed_time += 15
			return pre_intertesed_time
	pre_intertesed_time += 15
	if pre_intertesed_time > 90:
		pre_intertesed_time = 90
	return pre_intertesed_time

def get_interested_time_second_way():
	interested_times.insert(0, 0)
	for index in range(len(interested_times)):
		if index == 0:
			continue
		if interested_times[index] - interested_times[index - 1] > 15:
			return interested_times[index - 1]
	return interested_times[-1]
result = get_interested_time_second_way() + 15
if result > 90:
	result = 90
print(result)


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
a.insert(len(a), 90)
ans = 0
for i in range(1, len(a), 1):
	t = a[i] - a[i - 1]
	if t <= 15:
		ans += t
	else:
		ans += 15
		break
print(ans)


import math
from collections import Counter

def solve():
	n = int(input())
	T = [int(x) for x in input().split()]
	time = 0
	for t in T:
		if t > min(time + 15, 90):
			return min(time + 15, 90)
		else:
			time = t
	return min(time + 15, 90)
print(solve())


n = input()
ln = [int(i) for i in input().split(' ')]
time = 0
for i in ln:
	if i > time + 15:
		break
	else:
		time = i
print(min([time + 15, 90]))


n = int(input())
t = list(map(int, input().split()))
cnt = 0
if n == 1:
	if t[0] > 15:
		cnt = 15
	else:
		cnt = t[0] + 15
else:
	middle = False
	if t[0] > 15:
		cnt = 15
		middle = True
	else:
		cnt = t[0]
		for i in range(1, n):
			if t[i] - t[i - 1] <= 15:
				cnt += t[i] - t[i - 1]
			else:
				cnt += 15
				middle = True
				break
	if not middle:
		cnt = min(90, cnt + 15)
print(cnt)


import sys
import math
import itertools as it
import operator as op
import fractions as fr
n = int(sys.stdin.readline().strip())
T = map(int, sys.stdin.readline().split())
d = 0
for t in T:
	if t - d > 15:
		break
	else:
		d = t
d = min(d + 15, 90)
print(d)


n = int(input())
a = list(map(int, input().split()))
ans = 0
check = False
for i in range(n):
	if a[i] - ans > 15:
		ans += 15
		check = True
		break
	else:
		ans = a[i]
if not check:
	if 90 - ans <= 15:
		ans = 90
	else:
		ans += 15
print(ans)


n = int(input())
T = [0] + list(map(int, input().split())) + [90]
ok = 1
for i in range(1, n + 2):
	if T[i] - T[i - 1] > 15:
		print(T[i - 1] + 15)
		ok = 0
		break
if ok:
	print(90)


n = int(input())
l = list(map(int, input().split()))
if l[0] > 15:
	print(15)
	exit()
if n == 1 and l[0] <= 15:
	print(15 + l[0])
	exit()
if n == 1 and l[0] > 15:
	print(15)
	exit()
ans = []
for i in range(1, n):
	if l[i] - l[i - 1] <= 15:
		ans.append(l[i] + 15)
	elif l[i] - l[i - 1] > 15:
		print(l[i - 1] + 15)
		exit()
if ans[-1] > 90:
	print(90)
else:
	print(ans[-1])


b = int(input()) + 1
inn = list(map(int, input().split(' ')))
inn.append(90)

def ff():
	if inn[0] > 15:
		return 15
	for a in range(1, b):
		if inn[a] - inn[a - 1] > 15:
			return inn[a - 1] + 15
	return 90
print(ff())


a = int(input())
c = input().split()
dem = int(c[0])
if dem > 15:
	dem = 15
else:
	for i in range(a):
		d = int(c[i]) - dem
		if d > 15:
			dem = int(c[i - 1]) + 15
			break
		elif i + 1 != a:
			dem = int(c[i])
		elif int(c[a - 1]) > 75:
			dem = 90
		else:
			dem = int(c[a - 1]) + 15
print(dem)


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
l.append(90)
flag = 0
for i in range(1, n + 2):
	if l[i] - l[i - 1] > 15:
		flag = 1
		print(l[i - 1] + 15)
		break
if flag == 0:
	print(90)


number = int(input())
list_array = str(input())
list_array = list_array.split()
list_array = list_array[0:number]
x = 0
for i in range(len(list_array)):
	if int(list_array[i]) - x > 15:
		break
	else:
		x = int(list_array[i])
x = min([x + 15, 90])
print(x)


n = int(input())
A = list(map(int, input().split()))
g = 0
A.append(0)
A.append(90)
A.sort()
for i in range(len(A) - 1):
	if A[i + 1] - A[i] > 15:
		print(A[i] + 15)
		g = 10000
		break
if g == 0:
	print(90)


n = int(input())
s = [0] + list(map(int, input().split()))
isBreak = False
for i in range(len(s) - 1):
	if s[i + 1] - s[i] > 15:
		print(s[i] + 15)
		isBreak = True
		break
if not isBreak:
	print(min(90, s[-1] + 15))


n = int(input())
min = [int(i) for i in input().split()]
time = 0
index = 0
for i in min:
	if time + 15 >= i:
		time = i
	else:
		time += 15
		break
	index += 1
if index == n:
	time += 15
if time > 90:
	time = 90
print(time)


from itertools import *
from collections import Counter
from operator import *
from functools import reduce
import re
import math
from pprint import pprint
from fractions import gcd

def sqr(x):
	return x * x

def inputarray(func=int):
	return [func(elem) for elem in input().split()]
N = int(input())
A = sorted(list(set(range(1, 91)) - set(inputarray())))
k = 0
p = 0
for i in A:
	if i == p + 1:
		k += 1
	else:
		k = 1
	p = i
	if k == 15:
		print(i)
		quit()
print(90)


n = int(input())
a = [0]
p = False
a += list(map(int, input().split()))
a += [90]
for i in range(1, n + 2):
	if i == n + 1:
		if a[i] - a[i - 1] > 15:
			print(a[i - 1] + 15)
			break
		else:
			print(a[i])
	elif a[i] - a[i - 1] > 15:
		print(a[i - 1] + 15)
		break


x = int(input())
y = list(map(int, input().split(' ')))
offset = 0
watched = 0
base = 15
for t in y:
	duration = t - offset
	if duration <= base:
		total = offset + duration + base
		watched = total if total < 90 else 90
	else:
		watched = offset + base
		break
	offset = t
print(watched)


def main():
	input()
	a = 0
	for b in list(map(int, input().split())) + [90]:
		if b > a + 15:
			b = a + 15
			break
		a = b
	print(b)
main()


n = int(input())
l = list(map(int, input().split()))
c = 0
flag = 1
if l[0] > 15:
	print(15)
elif n == 1:
	print(l[0] + 15)
else:
	for i in range(n - 1):
		if l[i + 1] - l[i] > 15:
			c = l[i] + 15
			flag = 0
			break
		else:
			c = l[i]
	if flag == 1:
		if l[-1] + 15 < 90:
			print(l[-1] + 15)
		else:
			print(90)
	else:
		print(c)


n = int(input())
m = input()
minutes = [int(x) for x in m.split()]
ans = 0
check = False
for i in range(len(minutes)):
	if ans + 15 >= minutes[i]:
		ans = minutes[i]
	else:
		ans += 15
		check = True
		break
if ans + 15 < 90 and check == False:
	ans += 15
elif check == False:
	ans = 90
print(ans)


number_of_interested_times = int(input())
interested_times = list(map(int, input().split()))
result = 0

def get_interested_time():
	if number_of_interested_times == 1:
		if interested_times[0] > 15:
			return 15
		else:
			return interested_times[0] + 15
	pre_intertesed_time = 0
	for interested_time in interested_times:
		if interested_time - pre_intertesed_time <= 15:
			pre_intertesed_time = interested_time
		else:
			pre_intertesed_time += 15
			return pre_intertesed_time
	pre_intertesed_time += 15
	if pre_intertesed_time > 90:
		pre_intertesed_time = 90
	return pre_intertesed_time
print(get_interested_time())


n = int(input())
a = list(map(int, input().split()))
t = 15
for i in range(n):
	if a[i] > t:
		break
	else:
		t = a[i] + 15
if t > 90:
	print(90)
else:
	print(t)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst = get_int_list()
deadline = 15
for i in range(n):
	if lst[i] <= deadline:
		deadline = lst[i] + 15
	else:
		break
print(min(90, deadline))


n = int(input())
nmins = list(map(int, input().split()))
min = 0
if nmins[0] > 15:
	min = 15
else:
	for i in range(len(nmins)):
		if nmins[i] - nmins[i - 1] > 15:
			min = nmins[i - 1] + 15
			break
		elif 90 - nmins[-1] > 15:
			min = nmins[-1] + 15
		else:
			min = 90
print(min)


n = int(input())
a = list(map(int, input().split()))
cur_time = 0
for i in range(0, n):
	if a[i] > cur_time + 15:
		print(min(cur_time + 15, 90))
		break
	else:
		cur_time = a[i]
		if i == n - 1:
			print(min(cur_time + 15, 90))


n = int(input())
li = list(map(int, input().split()))
x = 0
for i in range(n):
	if li[i] - x > 15:
		x += 15
		print(x)
		break
	else:
		x = li[i]
else:
	x = li[n - 1]
	if x + 15 >= 90:
		x = 90
	else:
		x += 15
	print(x)


a = int(input())
b = input()
c = b.split()
if len(c) == 1:
	if int(c[0]) > 15:
		print(15)
	else:
		print(int(c[0]) + 15)
else:
	for i in range(a):
		if i == 0:
			if int(c[0]) > 15:
				print(15)
				break
		else:
			if int(c[i]) - int(c[i - 1]) > 15:
				print(int(c[i - 1]) + 15)
				break
			if i == len(c) - 1:
				if int(c[i]) + 15 > 90:
					print(90)
				else:
					print(int(c[i]) + 15)


n = int(input())
t = [0]
t += input().split(' ')
t += ['90']
time = 90
for i in range(n + 1):
	t[i + 1] = int(t[i + 1])
	if t[i + 1] - t[i] > 15:
		time = t[i] + 15
		break
print(time)


def will_watch_minutes(minutes_list: list) -> int:
	if minutes_list[0] > 15:
		return 15
	will_watch_minutes = minutes_list[0]
	for i in range(len(minutes_list) - 1):
		amount = minutes_list[i + 1] - minutes_list[i]
		if amount <= 15:
			will_watch_minutes += amount
		else:
			will_watch_minutes += 15
			break
		if i + 1 == len(minutes_list) - 1:
			final_minutes = 90 - minutes_list[i + 1]
			if final_minutes <= 15:
				will_watch_minutes += final_minutes
			else:
				will_watch_minutes += 15
	return will_watch_minutes + (15 if len(minutes_list) == 1 else 0)
num_interesting_minutes = input()
minutes_list = [int(i) for i in input().split()]
print(will_watch_minutes(minutes_list))


n = int(input())
l = [int(x) for x in input().split()]
l.insert(0, 0)
min = 0
for i in range(0, n, 1):
	sub = l[i + 1] - l[i]
	if sub > 15:
		min = l[i]
		break
	else:
		min = l[i + 1]
if min < 75:
	print(min + 15)
else:
	print(90)


n = int(input())
a = 15
s = list(map(int, input().strip().split(' ')))
last = 0
for i in range(n):
	if s[i] - last <= a:
		last = s[i]
	else:
		break
if last >= 75:
	print(90)
else:
	print(last + 15)


n = int(input())
lst = list(map(int, input().strip().split()))[:n]
s = lst[len(lst) - 1]
(a, b) = (0, 0)
f = 0
for (i, j) in enumerate(lst):
	if j - f > 15:
		f = f + 15
		a = 1
		break
	else:
		f = j
if a == 1:
	print(f)
elif s + 15 <= 90:
	print(s + 15)
else:
	print(90)


number_of_interesting_min = int(input())
l = list(map(int, input().split()))
min = 0
max = 90
interesting_min = 15
l[0] != min and l.insert(0, min)
l[len(l) - 1] != max and l.append(max)
minitues = 0
for i in range(0, len(l) - 1):
	minitues = l[i]
	if l[i + 1] - l[i] > interesting_min:
		break
minitues = minitues + interesting_min > max and max or minitues + interesting_min
print(minitues)


n = int(input())
t = list(map(int, input().split()))
s = 0
res = 0
for i in range(len(t)):
	if t[i] - s - 1 >= 15:
		res = s + 15
		break
	else:
		s = t[i]
		res = s + 15
res = min(res, 90)
print(res)


x = int(input())
t = 0
a = list(map(int, input().split()))
i = 0
if x == 1 and a[0] < 15:
	print(a[0] + 15)
else:
	while True:
		k = 0
		if i == x:
			k = 1
		if k == 0 and a[i] > t + 15:
			print(t + 15)
			break
		elif k == 0:
			t = a[i]
		if t + 15 <= 90 and k == 1:
			print(t + 15)
			break
		elif k == 1:
			print(90)
			break
		i = i + 1


n = int(input())
s = [0] + [int(i) for i in input().split()]
for i in range(n):
	if s[i + 1] - s[i] > 15:
		print(s[i] + 15)
		break
else:
	print(min(s[-1] + 15, 90))


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
for i in range(n):
	if l[i + 1] - l[i] > 15:
		print(l[i] + 15)
		n = 0
		break
if n != 0:
	print(min(90, l[-1] + 15))


n = int(input())
lastI = 0
found = False
r = map(int, input().split(' '))
for i in r:
	if i > 15 + lastI and 15 + lastI < 90:
		print(lastI + 15)
		found = True
		break
	else:
		lastI = i
if not found and lastI >= 75:
	print(90)
elif not found:
	print(lastI + 15)


def match(lst):
	a = [0] * 91
	for elem in lst:
		a[elem] = 1
	k = 0
	for i in range(1, len(a)):
		if a[i] == 1:
			k = i
		elif abs(i - k) >= 15:
			return i
	return 90
n = int(input())
b = [int(j) for j in input().split()]
print(match(b))


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
l.append(90)
t = 0
for i in range(1, len(l)):
	if l[i] - l[i - 1] <= 15:
		t += l[i] - l[i - 1]
	else:
		t = l[i - 1] + 15
		break
print(t)


a = int(input())
l = [int(i) for i in input().split()]
ans = False
for i in range(a):
	if i == 0:
		if l[i] > 15:
			print(15)
			ans = True
			break
		elif a == 1 and l[i] <= 15:
			print(l[i] + 15)
			ans = True
	elif l[i] > l[i - 1] + 15:
		print(l[i - 1] + 15)
		ans = True
		break
if not ans:
	print(min(90, l[a - 1] + 15))


def watch_tv(minutes):
	i = 0
	minutes += [200]
	while i < len(minutes) - 1:
		if i == 0 and minutes[i] > 15:
			count = 15
			break
		if minutes[i + 1] - minutes[i] > 15:
			count = minutes[i] + 15
			if minutes[i] >= 75:
				count = 90
			break
		i += 1
	print(count)
n = int(input())
m = [int(x) for x in input().split()]
watch_tv(m)


interesting = 0
upcoming = 15
minutes = []
number = int(input())
minutes = list(map(int, input().split()))
for i in range(number):
	if minutes[i] <= upcoming:
		interesting = minutes[i]
		upcoming = interesting + 15
	else:
		print(upcoming)
		exit()
	if upcoming > 90:
		print('90')
		exit()
print(upcoming)


def max_watching_time(arr):
	(max_time, t) = (0, 0)
	arr = arr + [90]
	for m in arr:
		if m - t > 15:
			return max_time + 15
		max_time += m - t
		t = m
	return max_time
n = int(input())
arr = list(map(int, input().split()))
print(max_watching_time(arr))


n = int(input())
a = list(map(int, input().split()))
res = 15
for i in a:
	if i <= res:
		res = i + 15
	else:
		break
if res > 90:
	res = 90
print(res)


n = int(input())
t = list(map(int, input().split()))
x = 90
for i in range(n):
	if i == 0:
		if t[i] - 1 >= 15:
			print(15)
			exit()
	elif t[i] - t[i - 1] > 15:
		print(t[i - 1] + 15)
		exit()
print(min(90, t[-1] + 15))


n = int(input())
t = list(map(int, input().split()))
t.append(90)
m = 0
for i in t:
	if i - m > 15:
		m += 15
		break
	else:
		m = i
print(m)


n = int(input())
arr = list(map(int, input().split()))

def minMinute(arr):
	t = 0
	for i in range(len(arr)):
		if arr[i] - t > 15:
			return min(90, t + 15)
		else:
			t = arr[i]
	return min(t + 15, 90)
print(minMinute(arr))


time1 = int(input())
time2 = input().split()
time2 = list(map(int, time2))
if time2[0] > 15:
	print(15)
else:
	for i in range(time1):
		if time2[i - 1] + 15 < time2[i]:
			print(time2[i - 1] + 15)
			break
		if i == time1 - 1:
			if time2[i] + 15 > 90:
				print(90)
			else:
				print(time2[i] + 15)


n = int(input())
m = input().split(' ')
m.insert(0, 0)
for i in range(0, len(m)):
	m[i] = int(m[i])
m.append(91)
f = 1
for i in range(1, len(m)):
	if m[i - 1] + 15 < m[i]:
		print(m[i - 1] + 15)
		f = 0
		break
if f == 1:
	print(90)


def main():
	n = int(input())
	c = 0
	minutes = [int(i) for i in input().split()]
	for m in minutes:
		if m - c - 1 >= 15:
			print(c + 15)
			return
		c = m
	if c + 15 <= 90:
		print(c + 15)
	else:
		print(90)
main()


import sys
n = int(input())
t = list(map(int, input().split(' ')))
last = 0
for i in range(0, n):
	if t[i] - last > 15:
		print(last + 15)
		sys.exit(0)
	last = t[i]
print(min(t[-1] + 15, 90))


input()
(*a,) = map(int, input().split())
b = 0
while a[0] <= b + 15:
	(b, *a) = a
	if not a:
		break
print(min(90, b + 15))


n = int(input())
cur = 15
for i in map(int, input().split()):
	if i > cur:
		break
	cur = i + 15
print(min(90, cur))


__author__ = 'artyom'

def main():
	n = read()
	a = [0] + read(3) + [91]
	for i in range(n + 1):
		if a[i + 1] - a[i] > 15:
			return a[i] + 15
	return 90

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


n = int(input())
array = [int(i) for i in input().split()]
if array[0] > 15:
	print(15)
else:
	sum_min = array[0]
	i = 0
	while i < n - 1:
		if array[i + 1] - array[i] <= 15:
			sum_min = array[i + 1]
			i += 1
		else:
			sum_min += 15
			break
	if i == n - 1:
		sum_min = min(sum_min + 15, 90)
	print(sum_min)


n = input()
t = list(map(int, input().split()))
n = [0 for _ in range(90)]
for i in t:
	n[i - 1] = 1
s = 0
ni = 0
for i in n:
	if ni == 15:
		break
	if i == 1:
		ni = 0
	elif i == 0:
		ni += 1
	s += 1
print(s)


n = int(input())
a = [int(k) for k in input().split()]
st = 15
m = 0
for i in range(n):
	if a[i] <= st:
		st = a[i] + 15
if st <= 90:
	print(st)
else:
	print(90)


def main():
	n = int(input())
	arr = input().split(' ')
	result = 0
	time = 0
	for i in range(n):
		time = int(arr[i]) - time
		result += min((time, 15))
		if time > 15:
			break
		if i == n - 1:
			result += min((90 - int(arr[n - 1]), 15))
		time = int(arr[i])
	print(result)
main()


n = int(input())
t = list(map(int, input().split()))
t.append(0)
t = sorted(t)
for i in range(1, len(t)):
	if t[i] - t[i - 1] > 15:
		print(t[i - 1] + 15)
		break
else:
	if max(t) > 74:
		print('90')
	else:
		print(max(t) + 15)


n = int(input())
li = list(map(int, input().split()))
c = 0
for i in li:
	if i - c > 15:
		break
	else:
		c = i
print(min(c + 15, 90))


n = int(input())
start = 0
end = -1
times = list(map(int, input().split())) + [90]
for t in times:
	d = t - start
	if d > 15:
		end = start
		break
	start = t
if end >= 0:
	print(min(end + 15, times[n]))
else:
	print(times[n])


n = int(input())
a = list(map(int, input().split()))
if a[0] > 15:
	print(15)
	exit()
s = a[0] + 15
for i in range(n - 1):
	if a[i + 1] - a[i] > 15:
		s = a[i] + 15
		break
	elif i == n - 2:
		s = a[i + 1] + 15
if s > 90:
	print(90)
else:
	print(s)


def solution(l1):
	i = 0
	if l1[0] > 15:
		return 15
	while i < len(l1) - 1:
		if l1[i + 1] - l1[i] > 15:
			return l1[i] + 15
		i += 1
	return min(l1[-1] + 15, 90)

def answer():
	n = int(input())
	l1 = [int(x) for x in input().split()]
	print(solution(l1))
answer()


def main():
	n = int(input())
	L = [int(x) for x in input().split()]
	print(solver(L))

def solver(L):
	if len(L) == 0 or L[0] > 15:
		return 15
	else:
		for i in range(len(L) - 1):
			if L[i + 1] - L[i] > 15:
				return L[i] + 15
		last = L[len(L) - 1]
		if last < 75:
			return last + 15
		else:
			return 90
L = [7, 20, 88]
L2 = [16, 20]
L3 = [15, 20, 30]
main()


def main():
	t1 = 0
	t2 = 0
	input()
	n = [int(i) for i in input().split()]
	if len(n) == 0:
		print(15)
		return
	for i in n:
		t1 = t2
		t2 = i
		if t2 - t1 > 15:
			if t1 + 15 < 91:
				print(t1 + 15)
			else:
				print(90)
			return
	if t2 + 15 < 91:
		print(t2 + 15)
	else:
		print(90)
	return
main()


n = int(input())
l = [int(x) for x in input().split()]
l.insert(0, 0)
l.append(90)
flag = 0
for i in range(len(l) - 1):
	if l[i + 1] - l[i] > 15:
		print(l[i] + 15)
		flag = 1
		break
if flag == 0:
	print(90)


n = int(input())
a = list(map(int, input().split()))
view = 0
pre = 0
for i in range(len(a)):
	cur = a[i]
	if cur - pre > 15:
		view += 15
		break
	else:
		view += cur - pre
		pre = cur
	if i == n - 1:
		if 90 - a[n - 1] <= 15:
			view += 90 - a[n - 1]
		else:
			view += 15
print(view)


n = int(input())
a = list(map(int, input().split(' ')))
a.insert(0, 0)
res = 0
limit = 15
for i in range(1, n + 1):
	if a[i] - a[i - 1] <= 15:
		res += a[i] - a[i - 1]
	else:
		res += limit
		print(res)
		exit()
if 90 - a[n] <= 15:
	res += 90 - a[n]
else:
	res += 15
print(res)


n = int(input())
temp = []
list = [int(i) for i in input().split()]
list.insert(0, 0)
for i in range(n):
	temp.append(list[i + 1] - list[i])
i = 0
while i < n:
	if temp[i] > 15:
		break
	i += 1
if list[i] + 15 >= 90:
	print(90)
else:
	print(list[i] + 15)


n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
a.append(90)
n += 2
t = a[0] + 15
for i in range(1, n):
	if a[i] > t:
		break
	else:
		t = a[i] + 15
if t > 90:
	print(90)
else:
	print(t)


read = lambda : map(int, input().split())
n = int(input())
t = list(read())

def calc():
	if t[0] > 15:
		return 15
	t.append(90)
	for i in range(n):
		if t[i] + 15 < t[i + 1]:
			return t[i] + 15
	return 90
print(calc())


n = input()
arr = [int(item) for item in list(input().split(' '))]
sum = 0
for (index, item) in enumerate(arr):
	if sum + 15 >= item:
		sum = item
	else:
		sum += 15
		break
	if index == len(arr) - 1:
		if sum + 15 >= item and sum + 15 < 90:
			sum += 15
		else:
			sum = 90
print(sum)


n = int(input())
m = list(map(int, input().split()))
m.append(90)
m.insert(0, 0)
a = 90
for i in range(n + 1):
	if m[i + 1] - m[i] > 15:
		a = m[i] + 15
		break
print(a)


def main():
	n = int(input())
	t = [int(i) for i in input().strip().split()]
	t.insert(0, 0)
	t.append(90)
	n += 2
	for i in range(0, n - 1):
		if t[i] + 15 < t[i + 1]:
			print(t[i] + 15)
			return
	print(90)
main()


n = int(input())
b = list(map(int, input().split()))
a = [0]
status = True
a.extend(b)
a.append(90)
for i in range(len(a) - 1):
	if a[i + 1] - a[i] > 15:
		print(a[i] + 15)
		status = False
		break
	elif a[i + 1] == 90:
		print(90)
		status = False
		break
if status == True:
	print(90)


(n, x) = (int(input()), [0] + [int(i) for i in input().split()] + [90])
for i in range(1, len(x)):
	if x[i] - x[i - 1] > 15:
		print(x[i - 1] + 15)
		exit()
print(90)


a = int(input())
b = list(map(int, input().split()))
cnt = 0
for i in range(0, len(b) - 1):
	if 0 + b[0] > 15:
		print('15')
		cnt += 1
		quit()
	elif b[i] + 15 < b[i + 1]:
		print(b[i] + 15)
		cnt += 1
		quit()
if cnt == 0 and a > 1 and (b[len(b) - 1] + 15 >= 90):
	print('90')
	quit()
if cnt == 0 and a > 1 and (b[len(b) - 1] + 15 < 90):
	print(b[len(b) - 1] + 15)
if a == 1 and b[0] <= 15:
	print(b[0] + 15)
elif a == 1 and b[0] > 15:
	print('15')


n = int(input())
l = 0
t = list(map(int, input().split()))
c = 15
for i in t:
	if i > c:
		break
	c = i + 15
print(min(c, 90))


n = int(input())
x = input()
list1 = x.split()
d = 0
list1.append(90)
for i in range(n + 1):
	if int(list1[i]) - d <= 15:
		d = int(list1[i])
	else:
		d += 15
		break
if d > 90:
	d = 90
print(d)


n = int(input())
a = list(map(int, input().split()))
b = 0
i = 0
while b + 15 >= a[i]:
	b = a[i]
	i = i + 1
	if i >= n or b >= 90:
		break
b = b + 15
if b > 90:
	b = 90
print(b)


input()
data = [0] + list(map(int, input().split())) + [90]
result = 0
for (cur, nxt) in zip(data, data[1:]):
	if nxt - cur > 15:
		result = cur + 15
		break
	result = nxt
print(result)


(n, x) = (int(input()), [0] + [int(i) for i in input().split()])
for i in range(1, len(x)):
	if x[i] - x[i - 1] > 15:
		print(x[i - 1] + 15)
		break
	if i == len(x) - 1:
		print(90 if x[i] + 15 > 90 else x[i] + 15)


import string

def reversed_list(l, start, end):
	if start >= end:
		return l
	(l[start], l[end]) = (l[end], l[start])
	return reversed_list(l, start + 1, end - 1)

def main_function():
	n = input()
	l = [int(i) for i in input().split(' ')]
	l = [0] + l
	l.append(90)
	init = l[0]
	for i in range(1, len(l)):
		if l[i] - init > 15:
			return init + 15
		init = l[i]
	return 90
print(main_function())


s = int(input())
l = list(map(int, input().split()))
flag = 0
for i in range(1, 91):
	if i == 90:
		print(i)
	elif i in l:
		flag = 0
	else:
		flag += 1
		if flag == 15:
			print(i)
			break


n = int(input())
t = list(map(int, input().split()))
result = t[0] + 15
if t[0] > 15:
	result = 15
else:
	for i in range(1, len(t)):
		if t[i] - t[i - 1] <= 15:
			result = t[i] + 15
			if result > 90:
				result = 90
		else:
			break
print(result)


n = int(input())
t = list(map(int, input().split()))
t.insert(0, 0)
k = [15 + t[i] for i in range(n) if t[i + 1] - t[i] > 15]
if len(k) == 0:
	print([90, t[-1] + 15][90 - t[-1] >= 15])
else:
	print(k[0])


n = int(input())
s = set(map(int, input().split()))
c = 0
k = 0
for i in range(1, 91):
	c += 1
	k += 1
	if i in s:
		k = 0
	if k == 15:
		break
print(c)


def main():
	n = int(input())
	arr = [int(i) for i in input().split(' ')]
	arr_sum = sum(arr)
	zeros = len([i for i in arr if i == 0])
	if -1 * arr_sum == zeros:
		print(zeros + 1)
		return
	print(max(0, zeros))

def possible(arr):
	halfsum = sum(arr) // 2
	if halfsum in arr:
		return True
	for i in range(0, 4):
		for j in range(i + 1, 4):
			if arr[i] + arr[j] == halfsum:
				return True
	return False

def is_palin(string):
	if not string or len(string) == 1:
		return True
	n = len(string)
	for i in range(0, n // 2):
		pass

def give(arr):
	prev = 0
	for val in arr:
		if val - prev > 15:
			prev = prev + 15
			return prev
		else:
			prev = val
	if 90 - prev <= 15:
		return 90
	else:
		return prev + 15
n = int(input())
arr = [int(i) for i in input().split(' ')]
print(give(arr))


n = int(input())
l = list(map(int, input().split()))
if n == 1:
	if l[0] <= 15:
		print(l[0] + 15)
	else:
		print(15)
	exit()
if l[0] > 15:
	print(15)
	exit()
for i in range(n - 1):
	if l[i + 1] - l[i] > 15:
		h = l[i] + 15
		if h > 90:
			print(90)
			exit()
		else:
			print(h)
			exit()
if l[n - 1] < 75:
	print(l[n - 1] + 15)
else:
	print(90)


import math
n = int(input())
a = list(map(int, input().split()))
t = 0
for i in range(n):
	if a[i] > t + 15:
		result = t + 15
		print(result)
		exit()
	elif a[i] <= t + 15:
		t = a[i]
	a[i] += 1
print(min(90, t + 15))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = LI()
	ans = 0
	for x in l:
		if ans + 15 < x:
			return ans + 15
		else:
			ans = x
	return min(90, ans + 15)
print(main())


f = lambda : map(int, input().split())
n = int(input())
l = [0] + list(f())
for (i, j) in zip(l, l[1:] + [90]):
	if j - i > 15:
		exit(print(i + 15))
print(90)


n = int(input())
BoringTimes = [int(i) for i in input().split(' ')]
flag = 0
if BoringTimes[0] > 15:
	flag = 1
	print('15')
else:
	for i in range(n - 1):
		if BoringTimes[i + 1] - BoringTimes[i] > 15:
			flag = 1
			print(BoringTimes[i] + 15)
			break
	if flag == 0 and BoringTimes[n - 1] < 75:
		flag = 1
		print(BoringTimes[n - 1] + 15)
if flag == 0:
	print('90')


def time_off(list_int):
	result = 15
	must_off = 90
	for item in list_int:
		if item > result:
			return result
		result = item + 15
	if result > must_off:
		return must_off
	return result
n = input()
list_int = list(map(int, input().split()))
print(time_off(list_int))


n = int(input())
a = input().split()
arr = []
for x in a:
	arr.append(int(x))
last = 0
if arr[0] > 15:
	print('15')
else:
	ddd = 1
	for i in range(0, len(arr)):
		if i > 0:
			if arr[i] - arr[i - 1] > 15:
				s = int(arr[i - 1] + 15)
				if s > 90:
					print('90')
				else:
					print(str(s))
				ddd = 0
				break
		if i == len(arr) - 1:
			if arr[i] < 75:
				print(arr[i] + 15)
			else:
				print('90')


n = int(input())
lst = list(map(int, input().split()))
ans = 0
cnt = 0
if n == 1:
	if lst[0] > 15:
		ans = 15
	else:
		ans = lst[0] + 15
else:
	for i in range(0, len(lst) - 1):
		if lst[0] > 15:
			ans = 15
			break
		else:
			dura = lst[i + 1] - lst[i]
			if dura > 15:
				ans = lst[i] + 15
				break
			else:
				cnt += 1
	if cnt == n - 1:
		ans = lst[n - 1] + 15
if ans > 90:
	ans = 90
	print(ans)
else:
	print(ans)


n = int(input())
a = list(map(int, input().split()))
cur = 15
for i in range(n):
	if a[i] > cur:
		break
	cur = a[i] + 15
cur = min(cur, 90)
print(cur)


n = int(input())
line = map(int, input().split())
rest = 0
for it in line:
	if rest + 15 < it:
		break
	else:
		rest = it
print(min(rest + 15, 90))


(n, t, c) = (int(input()), set(map(int, input().split())), 0)
for i in range(1, 91):
	c = 0 if i in t else c + 1
	if c == 15:
		print(i)
		exit()
print(90)


n = int(input())
a = list(map(int, input().split()))
flag = 0
if a[0] > 15:
	print(15)
	flag = 1
for i in range(1, n):
	if a[i] - a[i - 1] > 15 and flag == 0:
		print(a[i - 1] + 15)
		flag = 1
		break
else:
	if not flag:
		print(min(a[n - 1] + 15, 90))


q = int(input())
w = list(map(int, input().split())) + [234]
e = 15
while w[0] <= e:
	e = w[0] + 15
	del w[0]
print(90 if e >= 90 else e)


n = int(input())
s = list(map(int, input().split()))
s.append(90)
Cnt = 0
if s[0] > 15:
	Cnt += 15
else:
	Cnt += s[0]
	for k in range(1, n + 1):
		if s[k] - s[k - 1] <= 15:
			Cnt += s[k] - s[k - 1]
		else:
			if Cnt + 15 > 90:
				Cnt += 90 - s[k]
			else:
				Cnt += 15
			break
print(Cnt)


n = int(input())
a = []
a.append(0)
b = list(map(int, input().split()))
for i in range(n):
	x = b[i]
	a.append(x)
a.append(90)
n = int(len(a))
for i in range(1, n):
	if a[i] - a[i - 1] > 15:
		print(a[i - 1] + 15)
		exit(0)
print(90)


def cal_inter_minu(num_minutes_inter, n_minutes_inter):
	if num_minutes_inter == 1:
		if n_minutes_inter[0] > 15:
			return 15
		else:
			return n_minutes_inter[0] + 15
	for index in range(len(n_minutes_inter) - 1):
		if index == 0:
			if n_minutes_inter[index] > 15:
				return 15
		distance = n_minutes_inter[index + 1] - n_minutes_inter[index]
		if distance > 15:
			return n_minutes_inter[index] + 15
	if 90 - n_minutes_inter[-1] > 15:
		return n_minutes_inter[-1] + 15
	return 90
num_minutes_inter = int(input())
n_minutes_inter = list(map(int, input().split()))
print(cal_inter_minu(num_minutes_inter, n_minutes_inter))


n = int(input())
a = map(int, input().split())
cur = 0
prev = 0
for t in a:
	if t - prev > 15:
		break
	cur = t
	prev = t
cur = min(cur + 15, 90)
print(cur)


from typing import List

def solve(interesting_minutes: List[int], n: int) -> int:
	max_time = 90
	boring_time = 15
	watched_time = 0
	for i in interesting_minutes:
		if i - watched_time <= boring_time:
			watched_time = i
	return min(max_time, watched_time + boring_time)
n = int(input())
minutes = list(map(int, input().split(' ')))
print(solve(minutes, n))


def minutes(lst, n):
	res = 15
	end = len(lst) - 1
	if n == 1:
		if lst[0] <= 15:
			return lst[0] + 15
	if lst[0] > 15:
		return res
	for i in range(len(lst) - 1):
		if lst[i] + 15 < lst[i + 1]:
			res = lst[i] + 15
			if res > 90:
				res = 90
			break
		elif lst[end] + 15 <= 90:
			res = lst[end] + 15
		else:
			res = 90
	return res
n = int(input())
lst = list(map(int, input().split()))
print(minutes(lst, n))


n = int(input().strip())
minutes = map(int, input().strip().split(' '))
minutes = list(minutes)
start = 0
duration = 0
flag = 0
for i in minutes:
	if i - start > 15:
		duration += 15
		print(duration)
		flag = 1
		break
	elif i == 90 or 90 - i <= 15:
		print(90)
		flag = 1
		break
	elif i - start <= 15 and len(minutes) == 1:
		i = i + 15
		print(i)
		flag = 1
		break
	else:
		start = i
		duration = i
if flag == 0:
	print(min(90, duration + 15))


n = int(input())
m = list(map(int, input().split(' ')))
last = 15
if len(m) > 0:
	for i in range(n):
		if m[i] <= last:
			last = m[i] + 15
last = min(last, 90)
print(last)


n = int(input())
string = input()
minutes = list(map(int, string.split()))
minutes.append(90)
a = 0
for x in minutes:
	if x - a > 15:
		print(a + 15)
		break
	a = x
else:
	print(90)


t = int(input())
arr = [0] + list(map(int, input().split())) + [90]
maxx = 0
for i in range(t + 1):
	maxx = arr[i] + 15
	if arr[i] + 15 < arr[i + 1]:
		break
print(min(maxx, 90))


n = int(input())
t = [int(x) for x in input().split()]
t.append(90)
count = 0
previous = 0
for current in t:
	if current - previous > 15:
		count += 15
		break
	else:
		count = current
	previous = current
print(count)


n = int(input())
inp = input().split()
a = []
for i in inp:
	a.append(int(i))
t = 0
i = 0
while i < n and a[i] - t <= 15:
	t = a[i]
	i += 1
print(min(90, t + 15))


import sys
input()
a = sorted([0] + list(map(int, input().split())) + [90])
for i in range(1, len(a)):
	if a[i] - a[i - 1] > 15:
		print(min(a[i - 1] + 15, 90))
		sys.exit(0)
print(90)


n = int(input())
L = [int(i) for i in input().split()]
R = [0 for _ in range(91)]
for i in L:
	R[i] = 1
ans = 0
lim = 15
for i in range(1, 91):
	if not lim:
		break
	if R[i]:
		lim = 15
	else:
		lim -= 1
	ans += 1
print(ans)


n = int(input())
m = input().split()
m.insert(0, '0')
c = 15
for i in range(0, len(m) - 1):
	if int(m[i + 1]) <= int(m[i]) + 15:
		c = int(m[i + 1]) + 15
	else:
		break
if c > 90:
	c = 90
print(c)


N = int(input())
mas = [False] * 90
li = list(map(int, input().split()))
for i in li:
	mas[i - 1] = True
i = 0
sk = 0
while sk < 15 and i < 90:
	if not mas[i]:
		sk += 1
	else:
		sk = 0
	i += 1
print(i)


x = int(input())
l = list(map(int, input().split()))
i = 0
z = 0
y = 0
if l[0] > 15:
	z = 1
	y = 15
else:
	while i <= x - 1:
		if i == x - 1:
			if l[i] + 15 <= 90:
				z = 1
				y = l[i] + 15
				break
		elif l[i + 1] - l[i] > 15:
			z = 1
			y = l[i] + 15
			break
		i = i + 1
if z == 0:
	y = 90
print(y)


n = int(input())
k = [int(i) for i in input().split(' ')]
if k[0] > 15:
	print(15)
else:
	i = 1
	c = k[0] + 15
	while i < n:
		if c >= k[i] and c != 90:
			c = k[i] + 15
		i += 1
	if c >= 90:
		print(90)
	else:
		print(c)


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
n = I()
a = IL()
interesting = set(range(15))
for aa in a:
	interesting = interesting.union(range(aa, aa + 15))
print(min(min([i for i in range(110) if i not in interesting]), 90))


n = int(input())
a = [int(x) for x in input().split()]
ans = 15
for i in a:
	if i > ans:
		break
	else:
		ans = i + 15
if ans >= 90:
	print(90)
else:
	print(ans)


x = int(input())
l = list(map(int, input().split()))
s = 0
f = 0
for i in range(len(l) - 1):
	if l[0] > 15:
		f = 1
		print(15)
		break
	elif l[0] <= 15:
		if l[i] + 15 < l[i + 1]:
			s = l[i] + 15
			break
		else:
			s = l[i + 1]
if len(l) == 1 and f != 1 and (l[0] <= 15):
	print(l[0] + 15)
elif len(l) == 1 and f != 1 and (l[0] > 15):
	print(15)
elif not f and s == l[-1]:
	if s + 15 <= 90:
		print(s + 15)
	elif s + 15 > 90:
		print(90)
elif not f:
	print(s)


n = int(input())
a = [int(x) for x in input().split()]
a = [0] + a + [200]
z = 0
for i in range(n + 1):
	if a[i + 1] - a[i] > 15:
		z = i
		break
k = a[z] + 15
if k > 90:
	k = 90
print(k)


n = int(input())
tlist = input().split()
i = 0
intlist = [0]
while i < n:
	intlist.append(int(tlist[i]))
	i += 1
intlist.append(90)
difflist = []
i = 0
while i <= n:
	difflist.append(intlist[i + 1] - intlist[i])
	i += 1
x = []
i = 0
while i <= n:
	if difflist[i] > 15:
		x.append(intlist[i] + 15)
	i += 1
if len(x) > 0:
	print(x[0])
else:
	print(90)


n = int(input())
a = list(map(int, input().split()))
time = 0
t = 15
a.insert(0, 0)
for i in range(1, n + 1):
	if a[i] - a[i - 1] <= 15:
		time += a[i] - a[i - 1]
	else:
		time += t
		print(time)
		exit()
if 90 - a[n] <= 15:
	time += 90 - a[n]
else:
	time += 15
print(time)


n = int(input())
t = list(map(int, input().split()))
t = [0] + t + [90]
all = False
for i in range(len(t) - 1):
	if t[i + 1] - t[i] > 15:
		all = False
		if t[i] + 15 > 90:
			print(90)
		else:
			print(t[i] + 15)
		break
	else:
		all = True
if all:
	print(90)


n = int(input())
a = [0] + list(map(int, input().strip().split()))
ans = 15
for i in range(n + 1):
	if a[i] + 15 > ans:
		if a[i] + 15 - ans <= 15:
			ans = a[i] + 15
ans = min(ans, 90)
print(ans)


n = int(input())
list1 = [0] + [int(v) for v in input().split()] + [1000]
ans = 0
for i in range(1, n + 2):
	if list1[i] - list1[i - 1] <= 15:
		ans = list1[i]
	else:
		print(min(ans + 15, 90))
		break


n = int(input())
a = list(map(int, input().split()))
if a[0] > 15:
	print(15)
else:
	i = 0
	c = 0
	while c != 1 and i != n - 1:
		if a[i + 1] - a[i] > 15:
			c = 1
		else:
			i += 1
	print(min(a[i] + 15, 90))


n = int(input())
q = list(map(int, input().split()))
z = [0] * 91
for e in q:
	z[e] = 1
answer = 0
last15 = 0
for i in range(1, 91):
	if last15 >= 15:
		break
	if z[i] == 1:
		last15 = 0
	else:
		last15 += 1
	answer += 1
print(answer)


t = int(input())
l = [0]
l.extend(list(map(int, input().strip().split(' '))))
for i in range(1, t + 1):
	if l[i] - l[i - 1] > 15:
		print(l[i - 1] + 15)
		exit()
	else:
		continue
if 90 - l[-1] < 15:
	print(90)
else:
	print(l[-1] + 15)


n = int(input())
g = list(map(int, input().split()))
t = 0
for i in range(n):
	if i == 0:
		if g[i] - 1 < 15:
			if n == 1:
				t = g[i] + 15
			continue
		else:
			t = 15
			break
	if g[i] - g[i - 1] - 1 < 15:
		if i == n - 1 and g[i] < 75:
			t = g[i] + 15
			break
		continue
	else:
		t = g[i - 1] + 15
		break
if t == 0:
	t = 90
print(t)


n = int(input())
arr = list(map(int, input().split()))
arr.append(90)
arr.insert(0, 0)
count = 0
for i in range(n + 2):
	if arr[i] - count > 15:
		break
	else:
		count = arr[i]
if count == 0:
	print('15')
elif count >= 90:
	print('90')
else:
	print(str(count + 15))


n = int(input())
a = list(map(int, input().split()))
if a[0] > 15:
	print(15)
elif len(a) == 1:
	if a[0] > 15:
		print(15)
	else:
		print(a[0] + 15)
else:
	i = 1
	while i < n:
		k = a[i] - a[i - 1]
		if i == n - 1 and k <= 15:
			if 90 - a[-1] <= 15:
				s = 90
				break
			else:
				s = a[-1] + 15
				break
		elif i == n - 1 and k > 15:
			s = a[n - 2] + 15
			break
		elif k > 15:
			s = a[i - 1] + 15
			break
		i = i + 1
	print(s)


TIME_TO_SLEEP = 15
number_of_interesting_moments = int(input())
intersting_moments = list(map(int, input().split()))
counting_point = 0
for moment in intersting_moments:
	period = moment - counting_point
	if period > TIME_TO_SLEEP:
		break
	else:
		counting_point = moment
print(counting_point + 15) if counting_point + 15 < 90 else print(90)


n = int(input())
a = [0]
f = 1
a = a + list(map(int, input().split()))
a = a + [90]
for i in range(n + 1):
	if a[i + 1] - a[i] > 15:
		print(a[i] + 15)
		f = 0
		break
if f == 1:
	print(90)


n = int(input())
t = list(map(int, input().split()))
t = [0] + t + [200]
res = 0
for i in range(n + 1):
	if t[i + 1] - t[i] > 15:
		res = t[i] + 15
		break
print(min(res, 90))


def bear_and_game():
	n = int(input())
	m = list(map(int, input().split()))
	t = 0
	for x in m:
		if t + 15 < x:
			return t + 15
		else:
			t = x
	if t + 15 > 90:
		return 90
	else:
		return t + 15
print(bear_and_game())


def BearAndGame(n, a):
	time = 15
	for i in range(len(a)):
		if time >= a[i]:
			time = a[i]
			time += 15
	if time > 90:
		time = 90
	return time
n = int(input())
a = [int(x) for x in input().split()]
print(BearAndGame(n, a))


def f(l):
	for i in range(len(l)):
		if l[i] - l[i - 1] > 15:
			return l[i - 1] + 15
	return 90
n = int(input())
l = list(map(int, input().split()))
l.append(0)
if 90 not in l:
	l.append(90)
l.sort()
print(f(l))


def watching_minute(n, a):
	if a[0] > 15:
		return 15
	elif len(a) == 1:
		return a[0] + 15
	else:
		for i in range(len(a) - 1):
			if a[i + 1] - a[i] > 15:
				return a[i] + 15
			if a[i + 1] >= 75 or a[i] >= 75:
				return 90
			if i + 1 == len(a) - 1 and a[i + 1] < 75:
				return a[i + 1] + 15
n = int(input())
a = [int(i) for i in input().split()]
print(watching_minute(n, a))


n = int(input())
arr = list(map(int, input().split()))
prev = 0
interesting = 0
isBreak = False
for i in range(n):
	boring = arr[i] - prev
	if boring <= 15:
		interesting += boring
	else:
		interesting += 15
		isBreak = True
		break
	prev = arr[i]
if not isBreak and arr[-1] < 90:
	boring = 90 - arr[i]
	if boring <= 15:
		interesting += boring
	else:
		interesting += 15
print(interesting)


from sys import stdin
from sys import stdout
sprint = stdout.write
sinput = stdin.readline

def func():
	sprint('F')
n = int(sinput())
t = [int(x) for x in sinput().split()]
t.append(90)
t_0 = 0
while len(t) != 0:
	if t[0] - t_0 > 15:
		t_0 += 15
		break
	else:
		t_0 += t[0] - t_0
		t.pop(0)
print(min(t_0, 90))


def __starting_point():
	n = int(input())
	t = [0] + list(map(int, input().split()))
	ans = -1
	for i in range(1, n + 1):
		if t[i] - t[i - 1] - 1 >= 15:
			ans = i - 1
			break
	if ans != -1:
		print(t[ans] + 15)
	else:
		print(min(90, t[-1] + 15))
__starting_point()


n = int(input())
ls = list(map(int, input().split()))
timeoff = 0
if n == 1:
	if ls[0] - 1 >= 15:
		timeoff = 15
	else:
		timeoff = ls[0] + 15
else:
	for i in range(n):
		if i == 0:
			if ls[i] >= 16:
				timeoff = 15
				break
			else:
				timeoff = ls[i] + 15
		elif ls[i] > timeoff:
			break
		else:
			timeoff = ls[i] + 15
if timeoff > 90:
	timeoff = 90
print(timeoff)


def time_boring(n, T):
	ttime = 0
	for i in range(n):
		if T[i] - ttime > 15:
			return ttime + 15
		else:
			ttime = T[i]
	if ttime + 15 > 90:
		return 90
	return ttime + 15
n = int(input())
T = list(map(int, input().split()))
print(time_boring(n, T))


def main():
	n = int(input())
	m = list(map(int, input().split()))
	res = 0
	count = 0
	for i in range(1, 91):
		if count == 15:
			return res
			break
		res += 1
		count += 1
		if i in m:
			count = 0
	return res
print(main())


def main():
	input()
	num = [int(i) for i in input().split()]
	now = 0
	last = 0
	for i in num:
		last = now
		now = i
		if last + 15 < now:
			if last + 15 < 90:
				print(last + 15)
			else:
				print(90)
			return
	if now + 15 < 90:
		print(now + 15)
	else:
		print(90)
	return
a = int(input())
b = [0] + list(map(int, input().split())) + [90]
for i in range(a + 1):
	if b[i + 1] - b[i] > 15:
		print(b[i] + 15)
		exit()
print(90)


n = int(input())
l = [0] + list(map(int, input().split()))
i = 1
curr = 0
while i != n + 1 and l[i] - curr <= 15:
	curr = l[i]
	i += 1
print(min(90, l[i - 1] + 15))


n = int(input())
l = list(map(int, input().split()))
count = 0
for i in range(1, 91):
	if i == 90:
		print(i)
	elif i in l:
		count = 0
	else:
		count += 1
		if count == 15:
			print(i)
			break


n = int(input())
time = [0] + list(map(int, input().split())) + [90]
for i in range(n + 1):
	if time[i + 1] - time[i] > 15:
		print(min(time[i] + 15, 90))
		break
	elif i == n:
		print(90)


n = int(input())
a = list(map(int, input().split()))
ans = 15 if a[0] > 15 else 0
if ans != 15:
	for i in range(1, n):
		if a[i] - a[i - 1] > 15:
			ans = a[i - 1] + 15
			break
if 90 - a[n - 1] > 15 and ans == 0:
	ans = a[n - 1] + 15
if ans == 0:
	ans = 90
print(ans)


import sys
n = int(input())
z = list(map(int, input().split()))
z.append(91)
now = 0
for i in z:
	if i - now > 15:
		print(min(90, now + 15))
		return
	else:
		now = i
print(90)


n = int(input())
t = [x for x in map(int, input().split())]
t.insert(0, 0)
ans = 0
for i in range(len(t)):
	if t[i] - t[i - 1] > 15:
		ans = t[i - 1] + 15
		break
if ans == 0:
	ans = t[-1] + 15
ans = min(90, ans)
print(ans)


n = int(input())
minute = list(map(int, input().rstrip().split()))
sum = 0
if minute[0] > 15:
	sum = 15
else:
	minute.insert(0, 0)
	for i in range(len(minute) - 1):
		if minute[i + 1] - minute[i] <= 15:
			sum += minute[i + 1] - minute[i]
		else:
			break
	if sum < 75:
		sum += 15
	else:
		sum = 90
print(sum)


n = int(input())
t = list(map(int, input().split()))
b = 0
for i in range(n):
	if t[i] - b > 15:
		print(min(90, b + 15))
		exit()
	else:
		b = t[i]
print(min(90, b + 15))


3
n = input()
v = list(map(int, input().split()))
v = v[::-1]
v.append(0)
v = v[::-1]
v.append(91)
sol = 90
for i in range(0, len(v) - 1):
	if v[i] + 15 < v[i + 1]:
		sol = v[i] + 15
		break
sol = min(sol, 90)
print(sol)


def solve(n, t):
	i = 0
	s = 0
	t.insert(0, 0)
	t.append(91)
	while i < n + 1:
		if i + 1 < n + 2:
			d = t[i + 1] - t[i] - 1
			if d > 14:
				s += 15
				return s
			else:
				s = min(90, t[i + 1])
		i += 1
	return s

def main():
	n = int(input())
	t = list(map(int, input().split()))
	print(solve(n, t))
main()


n = int(input())
t = list(map(int, input().split()))
s = 0
for x in t:
	if x - s > 15:
		print(s + 15)
		break
	else:
		s = x
else:
	print(90 if s > 75 else s + 15)


n = int(input())
m = list(map(int, input().split()))
if len(m) == 1:
	if m[0] > 15:
		print(15)
	else:
		print(m[0] + 15)
for i in range(n - 1):
	if m[0] > 15:
		print(15)
		break
	elif m[i] + 15 < m[i + 1]:
		print(m[i] + 15)
		break
	elif i == n - 2 and m[n - 1] <= 74:
		print(m[n - 1] + 15)
		break
	elif i == n - 2 and m[n - 1] > 74:
		print(90)


n = int(input())
l = list(map(int, input().split()))
if len(l) == 1:
	if l[0] > 15:
		time = 15
	else:
		time = l[0] + 15
for i in range(len(l)):
	if l[i] <= 15 and i == 0:
		continue
	elif l[i] > 15 and i == 0:
		time = 15
		break
	if l[i] - l[i - 1] > 15:
		time = l[i - 1] + 15
		break
	elif l[i] - l[i - 1] <= 15:
		if i == len(l) - 1:
			if l[i] < 90:
				if 90 - l[i] <= 15:
					time = 90
				elif 90 - l[i] > 15:
					time = l[i] + 15
			else:
				time = 90
		else:
			continue
print(time)


n = int(input())
arr = list(map(int, input().split()))
arr.insert(0, 0)
arr.append(90)
timeSpent = 0
for i in range(1, n + 2):
	if arr[i] - arr[i - 1] > 15:
		timeSpent = arr[i - 1] + 15
		break
	else:
		timeSpent = arr[i] + 15
if timeSpent > 90:
	timeSpent = 90
print(timeSpent)


n = int(input())
t = list(map(int, input().split()))
t.append(0)
t = sorted(t)
output = 0
for i in range(len(t) - 1):
	output = t[i] + 15
	if t[i + 1] - t[i] > 15:
		break
	else:
		output = t[i + 1] + 15
print(min(output, 90))


n = int(input())
interesting = list(map(int, input().split(' ')))
start = 0
watch = 0
count = 0
for i in interesting:
	if i - start <= 15:
		watch = i
		start = i
	else:
		break
print(min(90, watch + 15))


n = int(input())
m = 90
L = [0] + [int(x) for x in input().split()] + [90]
for i in range(1, n + 2):
	if L[i] - L[i - 1] > 15:
		m = min(L[i - 1] + 15, 90)
		break
print(m)


n = int(input())
last = 0
for t in (int(x) for x in input().split()):
	if t - last > 15:
		break
	last = t
print(min(last + 15, 90))


n = int(input())
t = [int(i) for i in input().split()]
x = y = 0
for i in t:
	if x + 15 < i:
		y = 1
		x += 15
		break
	else:
		x = i
if y:
	print(x)
elif x > 74:
	print(90)
else:
	print(x + 15)


n = int(input())
a = n
a = list(map(int, input().split()))
c = 0
for i in a:
	if i - c <= 15:
		c = i
if a[0] - 0 > 15:
	print(15)
elif 90 - c >= 15:
	print(c + 15)
elif 90 - c < 15:
	print(90)


n = int(input())
l = input().split()
l.insert(0, 0)
l.append(90)
rs = 90
for i in range(1, n + 2):
	if int(l[i]) - int(l[i - 1]) > 15:
		rs = int(l[i - 1]) + 15
		break
print(rs)


def loop(arr, n):
	if arr[0] > 15:
		return 15
	for i in range(n):
		if arr[i] + 15 < arr[i + 1]:
			return arr[i] + 15
	return 90

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.append(90)
	print(loop(arr, n))
main()


n = int(input())
t = list(map(int, input().split()))
output = 0
prev = 0
for i in t:
	if i - prev > 15:
		output = prev + 15
		break
	else:
		output = i + 15
	if i == 90 or output > 90:
		output = 90
	prev = i
print(output)


n = int(input())
t = map(int, input().split())
pos = 0
for i in t:
	if i - pos - 1 < 15:
		pos = i
	else:
		break
print(min(pos + 15, 90))


n = int(input())
t = list(map(int, input().split()))
pre = 0
ans = 0
for i in range(n):
	if t[i] - pre <= 15:
		ans = t[i] + 15
		pre = t[i]
	else:
		ans = pre + 15
		break
print(min(90, ans))


n = int(input())
t = list(map(int, input().split()))
a = [0] * 91
c = True
for e in t:
	a[e] = 1
for i in range(1, 91):
	if a[i] == 1:
		a[i] = 0
	else:
		a[i] = a[i - 1] + 1
	if a[i] == 15:
		print(i)
		c = False
		break
if c == True:
	print(90)


n = int(input())
str_ms = str(input())
ms = str_ms.split(' ')
if int(ms[0]) - 0 > 15:
	print(15)
else:
	for i in range(len(ms)):
		if i == len(ms) - 1:
			check = int(ms[i]) + 15
			if check >= 90:
				print(90)
			else:
				print(check)
			break
		check = int(ms[i + 1]) - int(ms[i])
		if check > 15:
			print(int(ms[i]) + 15)
			break


n = int(input())
li = list(map(int, input().split()))
if li[0] > 15:
	print('15')
	quit()
if li[0] <= 15 and n == 1:
	print(li[0] + 15)
	quit()
for i in range(1, n):
	if li[i] - li[i - 1] > 15:
		print(li[i - 1] + 15)
		break
	elif 90 - li[-1] <= 15 and i == n - 1:
		print('90')
	elif li[-1] == 90 and i == n - 1:
		print('90')
	elif 90 - li[-1] > 15 and i == n - 1:
		print(li[-1] + 15)


import sys
length = int(input())
fun = list(map(int, input().split(' ')))
x = 0
for i in fun:
	if x + 15 < i:
		print(x + 15)
		sys.exit()
	x = i
if x + 15 < 90:
	print(x + 15)
else:
	print(90)


n = int(input())
nums = list(map(int, input().split()))
end = 15
for x in nums:
	if x > end:
		print(end)
		exit(0)
	else:
		end = x + 15
print(90 if end > 90 else end)


def p3():
	n = int(input())
	l = [int(i) for i in input().split()]
	i = 0
	t = 0
	f = 1
	while t < 90 and f == 1 and (i < n):
		t = t + 15
		if l[i] > t:
			f = 0
		else:
			t = l[i]
		i = i + 1
	if f == 1:
		t = t + 15
	print(min(90, t))
p3()


def check(n, a):
	a.insert(0, 0)
	a.append(90)
	for i in range(1, len(a)):
		if a[i] - a[i - 1] > 15:
			return a[i - 1] + 15
	return 90
n = int(input())
a = list(map(int, input().strip().split()))
print(check(n, a))


n = input()
n = int(n)
arr = input()
arr = list(arr.split(' '))
for (idx, val) in enumerate(arr):
	arr[idx] = int(val)
b = 15
i = 0
while i < n:
	if arr[i] > b:
		print(b)
		break
	else:
		b = arr[i] + 15
	if i == n - 1:
		if b >= 90:
			print(90)
			break
		else:
			print(b)
			break
	if b < arr[i + 1] or b >= 90:
		if b >= 90:
			print(90)
			break
		print(b)
		break
	else:
		i = i + 1


n = int(input())
g = list(map(int, input().split()))
t = 0
g.append(90)
if g[0] <= 15:
	t = g[0]
	for i in range(1, n):
		if g[i] - g[i - 1] <= 15:
			t = g[i]
		else:
			break
else:
	t = 0
t = min(t + 15, 90)
print(t)


from sys import exit
n = int(input())
t = [0] + list(map(int, input().split())) + [91]
for i in range(1, len(t)):
	if t[i] - t[i - 1] > 15:
		print(t[i - 1] + 15)
		exit()
print(90)


from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
n = int(input())
ml = tuple(map(int, input().split(' ')))
d = 15
for t in ml:
	if d < t:
		print(d)
		break
	else:
		d = t + 15
else:
	print(min(d, 90))


n = int(input())
a = list(input().split(' '))
a = list((int(x) for x in a))
res = a[0]
flag = True
if a[0] <= 15:
	for i in range(1, n):
		if a[i] - a[i - 1] > 15:
			res += 15
			flag = False
			break
		else:
			res = a[i]
else:
	res = 0
if flag:
	if res + 15 <= 90:
		res += 15
	else:
		res = 90
print(res)


n = int(input())
good = [0] + [int(z) for z in input().split()] + [90]
result = 90
for i in range(1, n + 2):
	if good[i] - good[i - 1] > 15:
		result = min(result, good[i - 1] + 15)
		break
print(result)


x = eval(input())
y = list(map(int, input().split()))
k = 15
i = 0
if y[i] > 15:
	print(15)
else:
	sum = y[i]
	while i < x - 1:
		if y[i + 1] - y[i] <= 15:
			sum = sum + (y[i + 1] - y[i])
		else:
			sum = sum + 15
			break
		i += 1
	if i == x - 1:
		if 90 - sum <= 15:
			print(90 - sum + sum)
		else:
			print(sum + 15)
	else:
		print(sum)


n = int(input())
list = []
string = input()
list1 = string.split(' ')
for str in list1:
	list.append(int(str))
if list[0] > 15:
	print(15)
	exit()
else:
	result = list[0]
	i = 1
	while i < n:
		if list[i] - list[i - 1] > 15:
			print(result + 15)
			exit()
		else:
			result += list[i] - list[i - 1]
			i += 1
	if list[n - 1] > 74:
		print(90)
		exit()
	else:
		print(list[n - 1] + 15)
		exit()


from sys import stdin, stdout

def main():
	number_of_moment = stdin.readline().rstrip()
	moments = [int(i) for i in stdin.readline().rstrip().split()]
	watching_minutes = 0
	for moment in moments:
		if watching_minutes + 15 < moment:
			break
		else:
			watching_minutes = moment
	if watching_minutes + 15 > 90:
		return 90
	else:
		return watching_minutes + 15
print(main())


n = int(input())
a = [int(x) for x in input().split()]
p = 0
for i in range(n):
	if a[i] - p > 15:
		break
	p = a[i]
print(min(p + 15, 90))


alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
t = list(map(int, input().split()))
s = 0
for i in range(90):
	if t.count(i + 1) == 0:
		s += 1
	else:
		s = 0
	if s == 15:
		print(i + 1)
		break
else:
	print(90)


import sys
import math
import bisect
import itertools
import random

def main():
	A = [0] * 91
	n = int(input())
	for a in list(map(int, input().split())):
		A[a] = 1
	cnt = 0
	ans = 90
	for i in range(1, 91):
		if A[i] == 0:
			cnt += 1
		else:
			cnt = 0
		if cnt == 15:
			ans = i
			break
	print(ans)
main()


n = int(input())
minutes = [int(i) for i in input().split()]
minutes.insert(0, 0)
minutes.append(90)
for i in range(n + 1):
	if abs(minutes[i] - minutes[i + 1]) > 15:
		print(15 + minutes[i])
		exit()
print(90)


n = int(input())
t = list(map(int, input().split()))
flag = 0
if t[0] > 15:
	flag = 1
	print(15)
elif len(t) == 1 and t[0] <= 15:
	flag = 1
	print(t[0] + 15)
else:
	for i in range(1, n):
		if t[i] - t[i - 1] > 15:
			flag = 1
			print(t[i - 1] + 15)
			break
if flag == 0:
	print(min(90, t[-1] + 15))


n = int(input())
l = list(map(int, input().split()))
happyMinus = 15
for t in l:
	if t <= happyMinus:
		happyMinus = t + 15
	else:
		break
if happyMinus > 90:
	happyMinus = 90
print(happyMinus)


n = int(input())
interest = list(map(int, input().split()))
minute = 15
if interest[0] > 15:
	print(minute)
	exit()
if n == 0:
	print(minute)
	exit()
else:
	for i in range(0, n):
		if interest[i] <= minute:
			minute = interest[i] + 15
		else:
			break
if minute > 90:
	print(90)
else:
	print(minute)


n = int(input())
a = list(map(int, input().split()))
diff = 0
for i in a:
	if i - diff > 15:
		break
	else:
		diff = i
diff = min(90, diff + 15)
print(diff)


def main():
	n = int(input())
	timer = list(map(int, input().split()))
	if timer[0] > 15:
		print(15)
	elif timer[0] <= 15 and n == 1:
		print(15 + timer[0])
	else:
		if timer[0] != 1:
			timer.insert(0, 0)
		for i in range(1, len(timer)):
			if timer[i] - timer[i - 1] > 15:
				stop = timer[i - 1] + 15
				break
			else:
				stop = timer[i] + 15
		if stop >= 90:
			print(90)
		else:
			print(stop)
main()


n = int(input())
arr = list(map(int, input().split()))

def minWatchingGame(arr):
	if arr[0] > 15:
		return 15
	for i in range(len(arr) - 1):
		if arr[i] + 15 < arr[i + 1]:
			return arr[i] + 15
	return min(90, arr[n - 1] + 15)
print(minWatchingGame(arr))


n = int(input())
a = set(map(int, input().split()))
k = sorted(a)
cnt = 0
for i in range(1, 91):
	if i not in a:
		cnt += 1
	else:
		cnt = 0
	if cnt == 15:
		if i == 14:
			print(15)
			quit()
		print(i)
		quit()
print(90)


read = lambda : map(int, input().split())
n = int(input())
t = list(read())
ans = 15
for i in range(n):
	if t[i] > ans:
		break
	ans = t[i] + 15
ans = min(ans, 90)
print(ans)


n = int(input())
a = list(map(int, input().split(' ')))
sum = 0
if n == 1:
	if a[0] > 15:
		sum = 15
	else:
		sum = a[0] + 15
elif a[0] > 15:
	sum = 15
else:
	sum = a[0]
	for i in range(1, n):
		dist = a[i] - a[i - 1]
		if dist > 15:
			sum += 15
			break
		else:
			sum = a[i]
		if i == n - 1:
			if sum + 15 > 90:
				sum = 90
			else:
				sum += 15
print(sum)


def calTime():
	n = int(input())
	a = [0]
	a = a + list(map(int, input().split()))
	a.append(1000)
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > 15:
			return min(a[i] + 15, 90)
print(calTime())


input()
t0 = 0
for t in map(int, input().split()):
	if t - t0 > 15:
		print(t0 + 15)
		break
	t0 = t
else:
	print(min(90, t0 + 15))


n = int(input())
t = [int(x) for x in input().split()]
cur = 0
time = 0
for i in range(n):
	if t[i] - cur > 15:
		time = cur + 15
		break
	cur = t[i]
if cur + 15 >= 90:
	time = 90
else:
	time = cur + 15
print(time)


n = int(input())
l = list(map(int, input().split()))
l.insert(0, 0)
l.append(90)
a = 0
for x in range(n + 1):
	d = l[x + 1] - l[x]
	if d <= 15:
		a += d
	else:
		a += 15
		break
print(a)


n = int(input())
a = [int(x) for x in input().split()]

def test():
	a.append(90)
	if a[0] > 15:
		print(15)
		return
	else:
		for i in range(n):
			if a[i + 1] - a[i] > 15:
				print(a[i] + 15)
				return
	print(90)
test()


n = int(input())
l = [0] + list(map(int, input().split())) + [900]
ans = 90
for i in range(1, n + 2):
	if l[i] - l[i - 1] > 15:
		ans = l[i - 1] + 15
		break
print(min(90, ans))


n = int(input())
list = input().split()
iCur = 0
iTemp = 0
iTotal = 0
bIsOver = False
for i in list:
	iCur = int(i)
	if iCur - iTemp > 15:
		iTotal += 15
		bIsOver = True
		break
	else:
		iTotal = iCur
		iTemp = iCur
if bIsOver == False:
	iTotal += 15
if iTotal < 15:
	iTotal += 15
elif iTotal > 90:
	iTotal = 90
print(iTotal)


def calc_mins(_t, _n):
	if _t[0] > 15:
		return 15
	for i in range(1, _n):
		if _t[i] - _t[i - 1] > 15:
			return t[i - 1] + 15
	if 90 - _t[_n - 1] > 15:
		return _t[n - 1] + 15
	return 90
n = int(input())
t = list(map(int, input().split()))
print(calc_mins(t, n))


n = int(input())
a = list(map(int, input().split()))
ans = 0
if a[0] > 15:
	print(15)
	exit()
a.append(200)
for i in range(1, n + 1):
	if a[i] - a[i - 1] > 15:
		ans = a[i - 1] + 15
		break
print(min(ans, 90))


input()
X = list(map(int, input().split()))
if X[0] > 15:
	print(15)
	exit()
if len(X) == 1:
	print(X[0] + 15)
	exit()
for i in range(1, len(X)):
	if X[i] - X[i - 1] > 15:
		print(X[i - 1] + 15)
		exit()
	if i == len(X) - 1:
		print(90 if 90 - X[i] <= 15 else X[i] + 15)
		exit()


n = int(input())
A = list(map(int, input().split()))
A = A[::-1]
A.append(0)
A = A[::-1]
m = 0
h = 0
for i in range(1, n + 1):
	if A[i] - A[i - 1] <= 15 or (i == 1 and A[i] - A[i - 1] < 16):
		m += A[i] - A[i - 1]
	else:
		m += min(15, A[i] - A[i - 1])
		h = 1
		break
if h == 0:
	m += 15
	m = min(m, 90)
print(m)


n = int(input())
s = [int(i) for i in input().split()]
m = s[0] + 15
if s[0] > 15:
	print(15)
else:
	c = 1
	for i in range(1, n):
		if s[i] - s[i - 1] <= 15 and c == 1:
			m = s[i] + 15
		else:
			c = 0
	if m > 90:
		print(90)
	else:
		print(m)


n = int(input())
lst = list(map(int, input().split()))
lst.insert(0, 0)
lst.append(90)
for i in range(n + 1):
	if lst[i + 1] - lst[i] > 15:
		print(lst[i] + 15)
		break
else:
	print(90)


n = int(input())
l = input().split()
if 90 - int(l[-1]) > 15:
	rs = int(l[-1]) + 15
else:
	rs = 90
if int(l[0]) > 15:
	rs = 15
else:
	for i in range(1, n):
		if int(l[i]) - int(l[i - 1]) > 15:
			rs = int(l[i - 1]) + 15
			break
print(rs)


n = int(input())
li = [int(x) for x in input().split()]

def run(li):
	if li[0] > 15:
		print(15)
	else:
		for i in range(len(li) - 1):
			if li[i + 1] - li[i] > 15:
				print(li[i] + 15)
				break
		else:
			print(min(li[-1] + 15, 90))
run(li)


n = int(input())
t = input().split()
current_time = 0
for i in t:
	i = int(i)
	if current_time + 15 < i:
		break
	else:
		current_time = i
print(min(current_time + 15, 90))


def bear_and_game_solution(mins):
	count = 0
	boring_step = 15
	i = 0
	while i < len(mins):
		if count + boring_step < mins[i]:
			return count + boring_step
		else:
			count = mins[i]
		i += 1
	return min(count + boring_step, 90)

def main():
	n = input()
	minutes = [int(min) for min in input().split()]
	print(bear_and_game_solution(minutes))
main()


n = int(input())
l = list(map(int, input().split()))
m = 0
s = 0
for i in range(n):
	if l[i] - m <= 15:
		m = l[i]
	else:
		m += 15
		s = 1
		break
if s == 0:
	if 90 - m <= 15:
		m = 90
	else:
		m += 15
print(m)


def countTotalWatchingTime(ar):
	totalMin = 0
	for time in ar:
		if time - totalMin > 15:
			return min(totalMin + 15, 90)
		else:
			totalMin = time
	if 90 - totalMin < 15:
		return 90
	else:
		return totalMin + 15
n = int(input())
ar = list(map(int, input().split()))
print(countTotalWatchingTime(ar))


def solve(n, data):
	if data[0] > 15:
		return 15
	else:
		for i in range(n - 1):
			t = data[i] + 15
			if t < data[i + 1]:
				return t
	t = data[n - 1] + 15
	if t < 90:
		return t
	else:
		return 90
n = int(input())
data = [int(x) for x in input().split()]
print(solve(n, data))


def function(arr):
	(mx, t) = (0, 0)
	arr = arr + [90]
	for m in arr:
		if m - t > 15:
			return mx + 15
		mx = mx + m - t
		t = m
	return mx
n = int(input())
arr = list(map(int, input().split()))
print(function(arr))


n = int(input())
b = list(map(int, input().split()))
a = [False] * 107
for x in b:
	a[x] = True
s = 1
no = 1
if a[1]:
	no = 0
loop = True
while s <= 90 and loop:
	s += 1
	if a[s]:
		no = 0
	else:
		no += 1
	if no >= 15:
		break
print(min(s, 90))


a = int(input())
b = input()
z = [int(n) for n in b.split()]
z.append(0)
z.append(90)
z.sort()
l = 0
for n in range(a + 1):
	if z[n + 1] - z[n] <= 15:
		continue
	else:
		l = z[n] + 15
		break
if l == 0:
	l = 90
print(l)


n = input()
s = input()
a = s.split(' ')
last = 0
res = 0
a.append(90)
for i in a:
	i = int(i)
	res += min(15, i - last)
	if i - last > 15:
		break
	last = i
print(res)


n = int(input())
L = input().split(' ')
L = list(map(int, L))
L.append(90)

def test(L):
	if L[0] > 15:
		return 15
	for i in range(1, len(L)):
		if L[i] - L[i - 1] > 15:
			return L[i - 1] + 15
	return 90
print(test(L))


n = int(input())
last = 0
for t in map(int, input().split()):
	if last + 15 < t:
		break
	else:
		last = t
print(min(90, last + 15))


n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
	flag = 0
	temp = a[i]
	for j in range(1, 16):
		count += 1
		if count == temp:
			flag = 1
			break
	if flag == 0:
		break
	if i == n - 1 and flag == 1:
		count = count + 15
		if count > 90:
			count = 90
print(count)


interesting_minutes = int(input())
minutes = input().split(' ')
count = 0
for i in range(interesting_minutes):
	if int(minutes[i]) - count > 15:
		count += 15
		break
	elif i == interesting_minutes - 1 and int(minutes[i]) < 90:
		count = int(minutes[i]) + 15
	else:
		count = int(minutes[i])
if count > 90:
	print(90)
else:
	print(count)


input()
interesting_minutes = list(map(int, input().split()))
if interesting_minutes[0] > 15:
	print(15)
else:
	for index in range(len(interesting_minutes)):
		if index == len(interesting_minutes) - 1:
			if 90 - interesting_minutes[index] > 15:
				print(interesting_minutes[index] + 15)
			else:
				print(90)
			break
		else:
			distance = interesting_minutes[index + 1] - interesting_minutes[index]
			if distance > 15:
				print(interesting_minutes[index] + 15)
				break


n = int(input()) + 1
t = [int(x) for x in input().split()]
t.append(90)
res = 0
if t[0] > 15:
	res = 15
else:
	for x in range(1, n):
		if t[x] - t[x - 1] > 15:
			res = t[x - 1] + 15
			break
if res == 0:
	print(90)
else:
	print(res)


def readInts():
	return map(int, input().split())
n = int(input())
good = [False] * 90
for i in readInts():
	good[i - 1] = True
ans = 0
badCnt = 0
for g in good:
	ans += 1
	if g:
		badCnt = 0
	else:
		badCnt += 1
		if badCnt == 15:
			break
print(ans)


first_line = input()
second_line = input()
n = int(first_line)
lst = list(map(lambda a: int(a), second_line.split()))

def solve1(n, lst):
	if lst[0] > 15:
		return 15
	for i in range(len(lst) - 1):
		if lst[i + 1] - lst[i] > 15:
			return lst[i] + 15
	return min(lst[n - 1] + 15, 90)
print(solve1(n, lst))


n = int(input())
t = [0] + [int(x) for x in input().split(' ')]
answer = min(90, t[-1] + 15)
for i in range(n):
	if t[i + 1] - t[i] > 15:
		answer = min(t[i] + 15, 90)
		break
print(answer)


n = input()
minutes = list(map(int, input().split()))
total_time = 0
mark = 0
for i in minutes:
	watching = min(i - mark, 15)
	total_time += watching
	if i - mark >= 16:
		break
	mark = i
if mark == minutes[-1]:
	total_time += min(90 - minutes[-1], 15)
print(total_time)


from sys import stdin
n = int(input())
arr = list(map(int, stdin.readline().split()))
arr.sort()
lst = 0
flag = True
for x in arr:
	if x - lst > 15:
		lst += 15
		flag = False
		break
	lst = x
if flag:
	lst = min(90, lst + 15)
print(lst)


n = int(input())
l = list(map(int, input().split()))
ans1 = 0
ans = 0
if l[0] > 15:
	print(15)
elif l[0] <= 15 and n == 1:
	print(l[0] + 15)
else:
	for i in range(len(l) - 1):
		if abs(l[i] - l[i + 1]) > 15:
			print(l[i] + 15)
			exit()
		else:
			ans = l[i + 1]
			ans1 += 1
	if ans > 75:
		print(90)
	else:
		print(ans + 15)


n = int(input())
x = list(map(int, input().split()))
x.insert(0, 0)
for i in range(1, len(x)):
	if x[i] - x[i - 1] > 15:
		print(x[i - 1] + 15)
		break
	elif i == len(x) - 1:
		print(min(x[i] + 15, 90))


n = input()
m = str(input()).split()
for (i, s) in enumerate(m):
	if i == 0:
		if int(s) > 15:
			k = 15
			break
		elif len(m) >= 2:
			if int(m[i + 1]) - int(s) > 15:
				k = int(s) + 15
				break
		else:
			k = int(s) + 15
			break
	elif i < len(m) - 1:
		if int(m[i + 1]) - int(s) > 15:
			k = int(s) + 15
			break
	elif i == len(m) - 1:
		if int(s) + 15 >= 90:
			k = 90
		else:
			k = int(s) + 15
print(k)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr = [0] + Arr + [90]
flag = 0
for i in range(1, n + 2):
	if Arr[i] - Arr[i - 1] > 15:
		print(min(Arr[i - 1] + 15, 90))
		flag = 1
		break
if flag == 0:
	print(90)


input()
A = list(map(int, input().split()))
lI = 0
an = 0
for a in A:
	if a - lI > 15:
		an += 15
		break
	else:
		an += a - lI
		lI = a
		if a == A[-1]:
			an = min(90, an + 15)
print(an)


n = input()
arr = [int(i) for i in input().split()]
i = 0
flag = 0
if arr[0] > 15:
	print('15')
	exit(0)
elif int(n) == 1:
	print(arr[0] + 15)
	exit(0)
else:
	while int(i) != int(n) - 1:
		if arr[i + 1] - arr[i] > 15:
			print(arr[i] + 15)
			flag = 1
			break
		i = int(i) + 1
if 90 - arr[int(n) - 1] > 15 and int(n) != 1 and (int(flag) != 1):
	print(arr[int(n) - 1] + 15)
	exit(0)
if int(i) == int(n) - 1 and int(n) != 1 and (int(flag) != 1):
	print('90')


def count_time(list_minutes, initial=0):
	output = 0
	if list_minutes == []:
		if initial in range(75, 90):
			return 90 - initial
		elif initial == 90:
			return 0
		else:
			return 15
	current = list_minutes[0]
	interval = abs(current - initial)
	if interval > 15:
		return 15
	else:
		return interval + count_time(list_minutes[1:], current)
no_use = input()
list_minutes = list(map(int, input().strip().split()))
print(count_time(list_minutes))


n = int(input())
tv = (int(i) for i in input().split())
a = 0
for b in tv:
	if b - a > 15:
		break
	a = b
time = a + 15
if time > 90:
	print(90)
else:
	print(time)


n = int(input())
a = list(map(int, input().split()))
prev = 0
for x in a:
	if x - prev > 15:
		break
	prev = x
print(min(prev + 15, 90))


n = int(input())
c = set(map(int, input().split()))
x = 0
while x <= 90:
	f = False
	for i in range(1, 16):
		if x + i in c:
			x = x + i
			f = True
	if not f:
		break
print(min(90, x + 15))


n = int(input())
lst = list(map(int, input().split()))
t0 = 0
tend = 90
for t in lst:
	if t > t0 + 15:
		break
	else:
		t0 = t
if t0 + 15 < tend:
	print(t0 + 15)
else:
	print(tend)


n = input()
f = list(map(int, input().split()))
watched = -1
for i in range(0, len(f)):
	if i == 0:
		if f[i] > 15:
			watched = 15
			break
	elif f[i] - f[i - 1] > 15:
		watched = f[i - 1] + 15
		break
if watched == -1 and len(f) == 1:
	watched = f[0] + 15
if watched == -1:
	if f[-1] + 15 >= 90:
		watched = 90
	else:
		watched = f[-1] + 15
print(watched)


interesting = int(input())
list = [int(x) for x in input().split()]
index = 0
boring = 0
boring_temp = 15
while boring_temp <= 90:
	if boring_temp >= list[index]:
		boring_temp = list[index]
	else:
		break
	index += 1
	boring_temp += 15
	if index >= len(list):
		break
if boring_temp >= 90:
	print(90)
else:
	print(boring_temp)


N = int(input())
A = [0] + list(map(int, input().split())) + [90]
for i in range(N + 1):
	if A[i + 1] - A[i] > 15:
		exit(print(A[i] + 15))
print(90)


def will_watch_minutes(n: int, minutes_list: list) -> int:
	will_watch_minutes = 0
	for i in range(n + 1):
		amount = minutes_list[i + 1] - minutes_list[i]
		if amount <= 15:
			will_watch_minutes += amount
		else:
			return min(will_watch_minutes + 15, 90)
	return will_watch_minutes
num_interesting_minutes = int(input())
minutes_list = [0] + [int(i) for i in input().split()] + [90]
print(will_watch_minutes(num_interesting_minutes, minutes_list))


def faster():
	var1 = int(input())
	var2 = list(map(int, input().split()))
	if var2[0] > 15:
		return 15
	elif var1 == 1:
		return var2[0] + 15
	for i in range(var1 - 1):
		if var2[i + 1] - var2[i] > 15:
			return var2[i] + 15
	if var2[len(var2) - 1] + 15 <= 90:
		return var2[len(var2) - 1] + 15
	else:
		return 90
print(faster())


n = int(input())
t = list(map(int, input().split()))
counter = 0
for i in range(n):
	if t[i] - counter > 15:
		break
	counter = t[i]
print(min(90, counter + 15))


def getTime(a, b):
	if len(b) == 1:
		if b[0] > 15:
			return 15
		return b[0] + 15
	for i in range(a):
		if i == 0 and b[0] > 15:
			return 15
		if b[i] - b[i - 1] > 15:
			return b[i - 1] + 15
		if i == len(b) - 1:
			if b[i] + 15 > 90:
				return 90
			return b[i] + 15
total = int(input())
minutes = list(map(int, input().split()))
times = getTime(total, minutes)
print(times)


n = int(input())
a = list(map(int, input().split()))
cutoff = 15
for x in a:
	if x > cutoff:
		break
	cutoff = x + 15
print(min(90, cutoff))


n = int(input())
a = []
a.append(0)
suma = 110
a = a + list(map(int, input().split()))
a.append(90)
n += 1
for i in range(n):
	if a[i] + 15 < a[i + 1]:
		suma = a[i] + 15
		break
print(min(suma, 90))


n = int(input())
arr = list(map(int, input().split()))
cnt = 0
i = 1
t = 0
while i <= 90:
	if t < n and arr[t] == i:
		t += 1
		cnt = 0
	else:
		cnt += 1
	if cnt == 15:
		print(i)
		break
	i += 1
else:
	print(90)


def game_watched(interesting_list, n):
	time = 0
	for i in range(n):
		if interesting_list[i + 1] - 15 <= interesting_list[i]:
			time = interesting_list[i + 1]
		else:
			break
	return time + 15
n = int(input())
lista = [0]
input_list = list(map(int, input().split()))
lista = lista + input_list
time = game_watched(lista, n)
if time > 90:
	print(90)
else:
	print(time)


n = int(input())
v = list(map(int, input().split()))
total = 0
mark = 1
for i in range(n):
	if v[i] - mark + 1 <= 15:
		total += v[i] - mark + 1
		mark = v[i] + 1
	else:
		total += 15
		print(total)
		exit()
print(min(90, total + 15))


def watch_time(n, a):
	interesting_minute = a
	minute = 0
	interesting_minute.insert(0, 0)
	interesting_minute.insert(len(interesting_minute), 90)
	for index in range(1, len(interesting_minute)):
		if interesting_minute[index] - interesting_minute[index - 1] > 15:
			minute = interesting_minute[index - 1] + 15
			break
		if interesting_minute[index] == 90:
			minute = 90
	return minute
n = int(input())
a = [int(i) for i in input().split()]
print(watch_time(n, a))


import sys
sys.stderr = sys.stdout

def interesting(n, T):
	k = 0
	t0 = 0
	for t in T:
		if t > t0 + 15:
			return t0 + 15
		t0 = t
	if 90 > t0 + 15:
		return t0 + 15
	return 90

def main():
	n = readint()
	T = readintl()
	print(interesting(n, T))

def readint():
	return int(input())

def readinti():
	return map(int, input().split())

def readintt():
	return tuple(readinti())

def readintl():
	return list(readinti())

def readinttl(k):
	return [readintt() for _ in range(k)]

def readintll(k):
	return [readintl() for _ in range(k)]

def log(*args, **kwargs):
	print(*args, **kwargs, file=sys.__stderr__)
main()


n = int(input())
l = list(map(int, input().split()))
m = True
for i in range(n):
	if i == 0:
		if l[i] - 15 > 0:
			print(15)
			m = False
			break
	elif l[i] - l[i - 1] > 15:
		k = l[i - 1] + 15
		if k >= 90:
			print(90)
			m = False
			break
		else:
			print(k)
			m = False
			break
if m:
	k = l[n - 1] + 15
	if k >= 90:
		print(90)
	else:
		print(k)


def magic(lit):
	for i in range(len(lit)):
		lit[i] = int(lit[i])
	return lit

def min(a, b):
	if a < b:
		return a
	else:
		return b
n = int(input())
ti = input().split()
ti = magic(ti)
ti.append(0)
ti.sort()
for i in range(1, n + 1):
	if ti[i] - ti[i - 1] > 15:
		ans = ti[i - 1]
		break
	else:
		ans = ti[i]
print(min(ans + 15, 90))


x = int(input())
o = 0
p = list(map(int, input().split()))
for i in range(x):
	if p[i] - o > 15:
		if o == 0:
			print(15)
		else:
			print(o + 15)
		exit()
	o = p[i]
if 90 - p[x - 1] <= 15:
	print(90)
else:
	print(p[x - 1] + 15)


def main():
	n = int(input())
	minutes = list(map(int, input().split()))
	minIndex = 0
	currentMinute = 0
	while minIndex != n:
		if minutes[minIndex] - currentMinute > 15:
			print((currentMinute + 15) % 91)
			return False
		currentMinute = minutes[minIndex] % 91
		if minutes[minIndex] > 90:
			print(90)
			return True
		minIndex += 1
	if currentMinute + 15 > 90:
		print(90)
	else:
		print(currentMinute + 15)
	return True
main()


def main():
	input()
	t = [int(_) for _ in input().split()] + [90]
	end = 0
	still_interesting = True
	next_interesting = 0
	while end < 90 and still_interesting:
		end = min(end + 15, 90)
		if end >= t[next_interesting]:
			end = t[next_interesting]
			next_interesting += 1
		else:
			still_interesting = False
	print(end)
main()


times = input()
interestMins = list(map(int, input().split()))
watched = 0
for min in interestMins:
	if min - watched > 15:
		break
	watched = min
watched = watched + 15
if watched > 90:
	watched = 90
print(watched)


n = int(input())
if n == 0:
	print(15)
else:
	num_input = input()
	a = [0]
	if n == 1:
		a.append(int(num_input))
	else:
		num_input = num_input.split(' ')
		for i in range(n):
			a.append(int(num_input[i]))
	a.append(90)
	timeWatch = 90
	for i in range(n + 1):
		if a[i + 1] - a[i] > 15:
			timeWatch = a[i] + 15
			break
	print(timeWatch)


n = input()
arr = input().split()
arr1 = list(map(int, arr))
arr1.append(90)
arr1.insert(0, 0)
sum = 0
for i in range(int(n) + 1):
	diff = arr1[i + 1] - arr1[i]
	if diff > 15:
		sum = arr1[i] + 15
		break
	else:
		sum = arr1[i + 1]
print(sum)


def solve():
	n = int(input())
	ar = list(map(int, input().split()))
	prev = 0
	for i in range(n):
		if ar[i] - prev > 15:
			print(prev + 15)
			return
		prev = ar[i]
	print(min(90, prev + 15))
solve()


n = int(input())
l_n = list((x for x in map(int, input().split())))
l_n.append(90)
t = 0
for n in l_n:
	if t + 15 < n:
		print(t + 15)
		quit()
	else:
		t = n
print(t)


n = int(input())
minutes = list(map(int, input().split()))
last_interest = 0
for i in range(n):
	if last_interest + 15 < minutes[i]:
		print(last_interest + 15)
		exit()
	else:
		last_interest = minutes[i]
print(min(last_interest + 15, 90))


n = int(input())
minutes = []
for i in range(91):
	minutes.append(False)
for x in input().split():
	x = int(x)
	minutes[x] = True
l = 0
i = 1
while i < 90:
	if minutes[i] == False:
		l += 1
	else:
		l = 0
	if l == 15:
		break
	i += 1
print(i)


n = int(input())
a = [int(x) for x in input().split()]
rez = 0
for e in range(n):
	if a[e] - rez <= 15:
		if e == 0:
			rez += a[e]
		else:
			rez += a[e] - rez
if 90 - rez <= 15:
	print(90)
else:
	print(rez + 15)


n = int(input())
a = sorted(list(map(int, input().split())))
a.insert(0, 0)
a.append(90)
z = 0
for i in range(1, n + 2):
	if a[i] - a[i - 1] > 15:
		print(a[i - 1] + 15)
		z = 1
		break
if z != 1:
	print(90)


c = 0
ans = [False] * 90
n = int(input())
a = [*map(int, input().split())]
for i in a:
	ans[i - 1] = True
y = range(90)
for i in y:
	if ans[i] == False:
		c += 1
	else:
		c = 0
	if c == 15:
		print(i + 1)
		break
if c != 15:
	print(90)