#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string a;
  cin >> a;
  sort(a.begin(), a.begin() + n);
  sort(a.begin() + n, a.end());
  bool unlucky = true;
  for (int i = 0; i < n; ++i)
    if (a[i] <= a[n + i]) {
      unlucky = false;
      break;
    }
  if (unlucky) {
    cout << "YES\n";
    return 0;
  } else {
    unlucky = true;
    for (int i = 0; i < n; ++i)
      if (a[i] >= a[n + i]) {
        unlucky = false;
        break;
      }
    if (unlucky) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
