#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  bool g, f;
  int x[100], y[100];
  string a;
  cin >> n;
  cin >> a;
  for (i = 0; i < n; i++) {
    if (a[i] == '0') x[i] = 0;
    if (a[i] == '1') x[i] = 1;
    if (a[i] == '2') x[i] = 2;
    if (a[i] == '3') x[i] = 3;
    if (a[i] == '4') x[i] = 4;
    if (a[i] == '5') x[i] = 5;
    if (a[i] == '6') x[i] = 6;
    if (a[i] == '7') x[i] = 7;
    if (a[i] == '8') x[i] = 8;
    if (a[i] == '9') x[i] = 9;
  }
  for (i = n; i < 2 * n; i++) {
    if (a[i] == '0') y[i - n] = 0;
    if (a[i] == '1') y[i - n] = 1;
    if (a[i] == '2') y[i - n] = 2;
    if (a[i] == '3') y[i - n] = 3;
    if (a[i] == '4') y[i - n] = 4;
    if (a[i] == '5') y[i - n] = 5;
    if (a[i] == '6') y[i - n] = 6;
    if (a[i] == '7') y[i - n] = 7;
    if (a[i] == '8') y[i - n] = 8;
    if (a[i] == '9') y[i - n] = 9;
  }
  sort(x, x + n);
  reverse(x, x + n);
  sort(y, y + n);
  reverse(y, y + n);
  for (i = 0; i < n; i++) {
    if (x[i] >= y[i]) g = 1;
  }
  for (i = 0; i < n; i++) {
    if (x[i] <= y[i]) f = 1;
  }
  if ((g == 1) && (f == 1))
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
