#include <bits/stdc++.h>
using namespace std;
int n, k, t, x, y, ct, flag;
string s, q;
int arr[200004];
signed main() {
  cin >> n;
  cin >> s;
  sort(s.begin(), s.begin() + n);
  sort(s.begin() + n, s.end());
  if (s[0] == s[n]) {
    cout << "NO" << endl;
    return 0;
  }
  flag = s[0] > s[n];
  int flag2 = s[n] > s[0];
  for (int i = 1; i < n; i++) {
    if (s[i] > s[n + i] != flag || flag2 != s[n + i] > s[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
