#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> n;
  cin >> s;
  vector<int> one;
  vector<int> two;
  for (int i = 0; i < n; i++) {
    int val = s[i] - '0';
    one.push_back(val);
  }
  for (int i = n; i < 2 * n; i++) {
    int val = s[i] - '0';
    two.push_back(val);
  }
  sort(one.begin(), one.end());
  sort(two.begin(), two.end());
  int cnt1 = 0;
  int cnt2 = 0;
  for (int i = 0; i < n; i++) {
    if (one[i] > two[i])
      cnt1++;
    else if (one[i] < two[i])
      cnt2++;
  }
  if (cnt1 == n || cnt2 == n) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
