n = int(input()) a,b,c = map(int,input().split()) ans = "No" if a < c: if a < b: ans = "Yes" elif a > c: if a > b: ans = "Yes" print(ans)