#include <bits/stdc++.h>
using namespace std;
int main() {
  string as;
  vector<int> av1, av2;
  int n, i, b = 0, c = 0, k, d;
  cin >> n;
  cin >> as;
  for (i = 0; i < n; i++) av1.push_back(as[i] - '0');
  for (i = n; i < as.size(); i++) av2.push_back(as[i] - '0');
  sort(av1.begin(), av1.end());
  sort(av2.begin(), av2.end());
  for (i = 0; i < n; i++) {
    if (av1[i] > av2[i]) b++;
    if (av1[i] < av2[i]) c++;
  }
  if ((b == n) || (c == n))
    cout << "YES";
  else
    cout << "NO";
  cin >> n;
}
