#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int left[105];
  int right[105];
  while (cin >> n) {
    string s;
    cin >> s;
    int j = 0;
    for (j; j < n; j++) left[j] = s[j] - '0';
    for (j; j < 2 * n; j++) right[j - n] = s[j] - '0';
    sort(left, left + n);
    sort(right, right + n);
    bool ok = true;
    int u = 0;
    for (int j = 0; j < n; j++) {
      int uu = left[j] - right[j];
      if (uu > 0) {
        if (u == -1) {
          ok = false;
          break;
        } else {
          u = 1;
        }
      } else {
        if (uu == 0) {
          ok = false;
          break;
        } else if (u == 1) {
          ok = false;
          break;
        } else {
          u = -1;
        }
      }
    }
    if (ok)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
