N = int(input()) A, B, C = map(int, input().split()) if (B > A and C > A) or (B < A and C < A): print("Yes") else: print("No")