import sys def input(): return sys.stdin.readline()[:-1] N = input() a, b, c = map(int, input().split()) if c == a or c == b: print('No') elif c < a and c < b and a < b: print('No') elif c > a and c > b and a > b: print('No') else: print('Yes')