#include <bits/stdc++.h>
using namespace std;
int n;
string second;
int cnt = 0, res = 0;
int a[111], b[111];
int main() {
  cin >> n >> second;
  for (int i = 0; i < n; i++) {
    a[i] = second[i] - '0';
  }
  for (int i = 0; i < n; i++) {
    b[i] = second[n + i] - '0';
  }
  sort(a, a + n);
  sort(b, b + n);
  for (int i = 0; i < n; i++) {
    if (a[i] > b[i]) cnt++;
  }
  if (cnt == n) {
    cout << "YES";
    exit(0);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] < b[i]) res++;
  }
  if (res == n) {
    cout << "YES";
    exit(0);
  }
  cout << "NO";
  return 0;
}
