input() A = tuple(map(int, input().split())) if A[0] <= 1 or A[-1] <= 1: print('Yes') else: print('No')