#include <bits/stdc++.h>
using namespace std;
int n;
string s, s1 = "", s2 = "";
bool t1, t2;
int main() {
  scanf("%d", &n);
  cin >> s;
  for (int i = 0; i < n; i++) s1 += s[i];
  for (int i = n; i < s.length(); i++) s2 += s[i];
  sort(s1.begin(), s1.end());
  sort(s2.begin(), s2.end());
  if (s1[0] < s2[0])
    t1 = true;
  else if (s1[0] > s2[0])
    t2 = true;
  else {
    puts("NO");
    return 0;
  }
  for (int i = 1; i < s1.length(); i++) {
    if (s1[i] < s2[i] && t2) {
      puts("NO");
      return 0;
    } else if (s1[i] > s2[i] && t1) {
      puts("NO");
      return 0;
    } else if (s1[i] == s2[i]) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}
