#include <bits/stdc++.h>
using namespace std;
char ar[10000];
int main() {
  int num, count = 0;
  cin >> num >> ar;
  sort(ar, ar + num);
  sort(ar + num, ar + 2 * num);
  int isvalid1 = 1, isvalid2 = 1;
  for (int i = 0; i < num; i++) {
    if (ar[i] <= ar[num + i]) {
      isvalid1 = 0;
      break;
    }
  }
  for (int i = 0; i < num; i++) {
    if (ar[i] >= ar[num + i]) {
      isvalid2 = 0;
      break;
    }
  }
  if (isvalid1 || isvalid2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
