#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  string s1 = s.substr(0, n);
  string s2 = s.substr(n);
  bool ok1 = 0, ok2 = 0, ok = 0;
  sort(s1.begin(), s1.end());
  sort(s2.begin(), s2.end());
  for (int i = 0; i < n; i++) {
    if (s1[i] > s2[i] && !ok2)
      ok1 = 1;
    else if (s1[i] < s2[i] && !ok1)
      ok2 = 1;
    else {
      ok = 1;
      break;
    }
  }
  if (!ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
