n = int(input()) a,b,c = map(int, input().split()) if (a < b and a < c) or (b < a and c < a): print("Yes") else: print("No")