#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int flag = 0;
  string s1;
  cin >> s1;
  long long int s[2 * n];
  for (auto i = 0; i < 2 * n; i++) {
    s[i] = s1[i] - 48;
  }
  sort(s, s + n);
  sort(s + n, s + (2 * n), greater<int>());
  if (s[0] > s[2 * n - 1]) {
    flag = 4;
  } else if (s[0] < s[2 * n - 1]) {
    flag = 3;
  } else {
    cout << "NO";
  }
  if (flag == 4) {
    long long int f1 = 0;
    for (auto i = 0; i < n; i++) {
      if (s[i] <= s[2 * n - i - 1]) {
        cout << "NO";
        f1 = 1;
        break;
      }
    }
    if (f1 == 0) {
      cout << "YES";
    }
  } else if (flag == 3) {
    long long int f1 = 0;
    for (auto i = 0; i < n; i++) {
      if (s[i] >= s[2 * n - i - 1]) {
        cout << "NO";
        f1 = 1;
        break;
      }
    }
    if (f1 == 0) {
      cout << "YES";
    }
  }
  return 0;
}
