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