#include <bits/stdc++.h>
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
void solve() {
  int n;
  cin >> n;
  string q;
  cin >> q;
  string second = "", t = "";
  char x;
  for (int i = 0; i < n; i++) {
    x = q[i];
    second += x;
  }
  for (int j = n; j < (2 * n); j++) {
    x = q[j];
    t += x;
  }
  sort(second.begin(), second.end());
  sort(t.begin(), t.end());
  int flag = 0;
  if (second[0] < t[0]) {
    for (int i = 0; i < n; i++) {
      if (second[i] >= t[i]) {
        flag = 1;
        break;
      }
    }
  } else if (second[0] == t[0]) {
    flag = 1;
  } else {
    for (int i = 0; i < n; i++) {
      if (second[i] <= t[i]) {
        flag = 1;
        break;
      }
    }
  }
  (flag == 0) ? puts("YES") : puts("NO");
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
