#include <bits/stdc++.h>
using namespace std;
int N;
string s;
vector<int> v1;
vector<int> v2;
int main() {
  scanf("%d", &N);
  cin >> s;
  int i;
  for (i = 0; i < N; i++) v1.push_back(s[i] - '0');
  for (i = N; i < s.size(); i++) v2.push_back(s[i] - '0');
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  int cur = -1;
  for (i = 0; i < N; i++) {
    int v;
    if (v1[i] < v2[i])
      v = 1;
    else if (v1[i] > v2[i])
      v = 2;
    else {
      cur = -2;
      break;
    }
    if (cur == -1)
      cur = v;
    else if (cur != v) {
      cur = -2;
      break;
    }
  }
  if (cur == -2)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
