N = int(input()) a, b, c = map(int, input().split()) print("Yes" if (c - a) * (b - a) > 0 else "No")