#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second < b.second) return true;
  if (a.second == b.second) return a.first < b.first;
  return false;
}
bool isprime(int n) {
  if (n <= 1) return false;
  for (int i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
bool isPowerOfTwo(int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string l = "", r = "";
    for (int i = 0; i < n; i++) l += s[i];
    for (int i = n; i < s.size(); i++) r += s[i];
    sort(l.begin(), l.end());
    sort(r.begin(), r.end());
    int p = 0;
    if (l[0] > r[0])
      p = 0;
    else
      p = 1;
    bool d = true;
    if (p == 0) {
      for (int i = 0; i < l.size(); i++) {
        if (l[i] > r[i])
          continue;
        else {
          d = false;
          break;
        }
      }
    } else {
      for (int i = 0; i < l.size(); i++) {
        if (l[i] < r[i])
          continue;
        else {
          d = false;
          break;
        }
      }
    }
    if (d == true)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
