#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a, b;
  string s;
  int n, cnt = 0;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    a.push_back(s[i]);
    b.push_back(s[i + n]);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    if (a[i] == b[i]) {
      cout << "NO";
      return 0;
    } else if (a[i] > b[i])
      cnt++;
  }
  if (cnt == 0 || cnt == n)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
