#include <bits/stdc++.h>
void A(char ZA[], int a, int b) {
  int c, d, e, f;
  if (a < b) {
    c = a + (b - a + 1) / 2;
    d = ZA[c];
    ZA[c] = ZA[b];
    e = a - 1;
    for (f = a; f < b; ++f)
      if (ZA[f] < d) {
        e += 1;
        c = ZA[e];
        ZA[e] = ZA[f];
        ZA[f] = c;
      }
    ZA[b] = ZA[e + 1];
    ZA[e + 1] = d;
    A(ZA, a, e);
    A(ZA, e + 2, b);
  }
}
int main() {
  int a, b, c;
  char ZA[201];
  scanf("%d", &a);
  scanf("%s", ZA);
  A(ZA, 0, a - 1);
  A(ZA, a, 2 * a - 1);
  if (ZA[0] == ZA[a]) {
    printf("NO\n");
  } else if (ZA[0] < ZA[a]) {
    b = 1;
    c = a + 1;
    while (b < a) {
      if (ZA[b] >= ZA[c]) break;
      b += 1;
      c += 1;
    }
    if (b < a)
      printf("NO\n");
    else
      printf("YES\n");
  } else {
    b = 1;
    c = a + 1;
    while (b < a) {
      if (ZA[b] <= ZA[c]) break;
      b += 1;
      c += 1;
    }
    if (b < a)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
