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