n = int(input()) a, b, c = map(int,input().split()) if b < min(a, c) or b > max(a, c): print('No') else: print('Yes')