#include <bits/stdc++.h>
using namespace std;
const int MAX_L = 100;
int N;
char buf[2 * MAX_L + 1];
void init() { scanf("%d %s ", &N, buf); }
bool solve() {
  sort(buf, buf + N);
  sort(buf + N, buf + 2 * N);
  int t = 0, f = 0;
  for (int i = 0; i < N; i++) {
    if (buf[i] < buf[i + N]) {
      t++;
    } else if (buf[i] > buf[i + N]) {
      f++;
    }
  }
  return (t == 0 || f == 0) && t + f == N;
}
int main() {
  init();
  puts(solve() ? "YES" : "NO");
  return 0;
}
