#include <bits/stdc++.h>
using namespace std;
const long long LINF = ~(((long long)0x1) << 63) / 2;
const int INF = 0X3F3F3F3F;
const double eps = 1e-7;
int a[110];
int b[110];
int main() {
  int n;
  string s;
  cin >> n;
  cin >> 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);
  bool flag = false;
  int cura = 0, curb = 0;
  while (cura < n && curb < n) {
    if (a[cura] >= b[curb]) break;
    cura++;
    curb++;
  }
  if (cura == n && curb == n) flag = true;
  cura = n - 1;
  curb = n - 1;
  cura = 0, curb = 0;
  while (cura < n && curb < n) {
    if (a[cura] <= b[curb]) break;
    cura++;
    curb++;
  }
  if (cura == n && curb == n) flag = true;
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
