#include <bits/stdc++.h>
using namespace std;
long long int tc, cnt = 0, number, many, total = 0;
int rmove[4] = {0, 0, -1, 1};
int cmove[4] = {1, -1, 0, 0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string str;
  cin >> many >> str;
  sort(str.begin(), str.begin() + many);
  sort(str.begin() + many, str.end());
  bool one = false, two = false;
  int now = 0;
  for (int i = 0; i < many; i++) {
    int a = str[i] - '0', b = str[many + i] - '0';
    if (a >= b) break;
    now++;
  }
  if (now == many) one = true;
  now = 0;
  for (int i = 0; i < many; i++) {
    int a = str[i] - '0', b = str[many + i] - '0';
    if (a <= b) break;
    now++;
  }
  if (now == many) two = true;
  if (one || two)
    cout << "YES";
  else
    cout << "NO";
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
