#include <bits/stdc++.h>
using namespace std;
int n;
char s[250];
int main() {
  int i;
  bool b1 = 0, b2 = 0;
  cin >> n >> s;
  sort(s, s + n);
  sort(s + n, s + 2 * n);
  for (int i = 0; i < n; i++) {
    if (s[i] <= s[i + n]) b1 = 1;
    if (s[i] >= s[i + n]) b2 = 1;
  }
  if (b2 ^ b1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
