#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  sort(s.begin(), s.begin() + n);
  sort(s.begin() + n, s.end());
  if (s[0] == s[n]) {
    cout << "NO";
    return 0;
  } else if (s[0] > s[n]) {
    for (int i = 1; i < n; i++) {
      if (s[i] <= s[n + i]) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  } else {
    for (int i = 1; i < n; i++) {
      if (s[i] >= s[n + i]) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  }
  return 0;
}
