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