#include <bits/stdc++.h>
using namespace std;
int ar[105];
int ray[105];
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string t;
  cin >> t;
  for (int i = 0; i < n; i++) ar[i] = t[i] - 48;
  for (int i = 0; i < n; i++) ray[i] = t[i + n] - 48;
  sort(ar, ar + n);
  sort(ray, ray + n);
  if (ar[0] == ray[0]) {
    cout << "NO";
    return 0;
  }
  if (ar[0] < ray[0]) {
    for (int i = 1; i < n; i++) {
      if (ar[i] >= ray[i]) {
        cout << "NO";
        return 0;
      }
    }
  }
  if (ar[0] > ray[0]) {
    for (int i = 1; i < n; i++) {
      if (ar[i] <= ray[i]) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
  return 0;
}
