N = int(input()) A, B, C = map(int, input().split()) d = [A, B, C] d.sort() if A == C or B == C: exit(print("No")) if C < A < B or C > A > B or B > C > A or B < C < A: exit(print("No")) print("Yes")