#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int a1[n], a2[n];
  for (int i = 0; i < n; i++) a1[i] = s[i] - '0';
  for (int i = n; i < 2 * n; i++) a2[i - n] = s[i] - '0';
  for (int i = 0; i < n; i++) {
    int s1(i), s2(i);
    for (int j = i + 1; j < n; j++) {
      if (a1[j] < a1[s1]) s1 = j;
      if (a2[j] < a2[s2]) s2 = j;
    }
    swap(a1[i], a1[s1]);
    swap(a2[i], a2[s2]);
  }
  int l(0), m(0);
  for (int i = 0; i < n; i++)
    if (a1[i] < a2[i])
      l += 1;
    else if (a1[i] > a2[i])
      m += 1;
    else if (a1[i] == a2[i]) {
      cout << "NO" << endl;
      return 0;
    }
  if ((l == n) || (m == n))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
