#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[102], b[102], fal, y1, y2;
  char s[205];
  fal = y1 = y2 = 0;
  scanf("%d", &n);
  scanf("%s", s);
  for (int i = 0; i < n; i++) a[i] = s[i] - '0';
  for (int i = n; i < 2 * n; i++) b[i - n] = s[i] - '0';
  sort(a, a + n);
  sort(b, b + n);
  if (a[0] > b[0]) fal = 1;
  if (fal) {
    for (int i = 0; i < n; i++)
      if (a[i] <= b[i]) {
        y1 = 1;
        break;
      }
  } else {
    for (int i = 0; i < n; i++)
      if (a[i] >= b[i]) {
        y2 = 1;
        break;
      }
  }
  if (y1 == 1 || y2 == 1)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
