#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int arr1[n], arr2[n];
  for (int i = 0; i < n; ++i) arr1[i] = int(s[i]);
  for (int i = 0; i < n; ++i) arr2[i] = int(s[n + i]);
  sort(arr1, arr1 + n);
  sort(arr2, arr2 + n);
  bool flag = arr1[0] > arr2[0];
  for (int i = 0; i < n; ++i) {
    bool flag1 = arr1[i] > arr2[i];
    if (flag1 != flag || arr1[i] == arr2[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
