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