import sys readline=sys.stdin.readline N=int(readline()) A=list(map(int,readline().split())) if A[0]>A[-1]: print("No") else: print("Yes") queue=[] ans_lst=[] for a in A[1:-1]: queue.append(a) while len(queue)>=2 and queue[-2]