N = int(input()) a,b,c = map(int,input().split()) if (a < b and c < b) or (b < a and b < c): print('Yes') else: print('No')