#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum1 = 0, sum2 = 0;
  cin >> n;
  string str;
  cin >> str;
  for (int i = 0; i < n; i++) {
    sum1 += str[i];
  }
  for (int j = n; j < 2 * n; j++) {
    sum2 += str[j];
  }
  if (sum1 == sum2)
    cout << "NO" << endl;
  else {
    int more = 0, les = 0, eqal = 0;
    string str1;
    string str2;
    for (int i = 0; i < n; i++) {
      str1 += str[i];
    }
    for (int i = n; i < 2 * n; i++) {
      str2 += str[i];
    }
    sort(str1.begin(), str1.end());
    sort(str2.begin(), str2.end());
    for (int i = 0; i < n; i++) {
      if (str1[i] > str2[i]) more++;
      if (str1[i] < str2[i]) les++;
      if (str1[i] == str2[i]) eqal++;
    }
    if (eqal > 0 || (les > 0 && more > 0))
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
