#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> m;
vector<long long int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  string f;
  string sec;
  for (long long int i = 0; i < n; i++) f.push_back(s[i]);
  for (long long int i = n; i < 2 * n; i++) sec.push_back(s[i]);
  sort(f.begin(), f.end());
  sort(sec.begin(), sec.end());
  long long int less = 0, more = 0;
  for (long long int i = 0; i < n; i++) {
    if (f[i] < sec[i]) less++;
    if (f[i] > sec[i]) more++;
  }
  if (less == n || more == n)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
