#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  string a = s.substr(0, s.size() / 2);
  string b = s.substr(s.size() / 2);
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  bool f = false;
  for (long long int i = 0; i < a.size(); i++) {
    if (a[i] > b[i]) {
    } else {
      f = true;
      break;
    }
  }
  bool fl = false;
  if (f == true) {
    for (long long int i = 0; i < a.size(); i++) {
      if (a[i] < b[i]) {
      } else {
        fl = true;
        break;
      }
    }
  }
  if (fl == true) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}
int32_t main() {
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
