#include <bits/stdc++.h>
using namespace std;
class Heap {
  int size;

 public:
  int *har;
  Heap(int ar[], int n);
  void maxheapify(int i);
};
Heap::Heap(int ar[], int n) {
  har = ar;
  size = n;
  for (int i = (n - 1) / 2; i >= 0; i--) {
    maxheapify(i);
  }
}
void Heap ::maxheapify(int i) {
  int l = 2 * i + 1;
  int r = 2 * i + 2;
  int m = i;
  if (i >= size) return;
  if (l < size && har[l] > har[m]) m = l;
  if (r < size && har[r] > har[m]) m = r;
  if (m != i) {
    swap(har[m], har[i]);
    maxheapify(m);
  }
  return;
}
int main() {
  int n, temp;
  cin >> n;
  int ar[200];
  for (int i = 0; i < 2 * n; i++) {
    cin >> temp;
    ar[i] = temp;
  }
  if (n == 1) {
    if (ar[0] == ar[1])
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
    }
  } else {
    Heap heap(ar, n + 1);
    for (int i = n + 1; i < 2 * n; i++) {
      if (ar[i] < heap.har[0]) {
        heap.har[0] = ar[i];
        heap.maxheapify(0);
      }
    }
    int x = heap.har[0];
    int y = heap.har[1] > heap.har[2] ? heap.har[1] : heap.har[2];
    if (x == y)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
    }
  }
}
