#include <bits/stdc++.h>
using namespace std;
bool compare(int *a, int *b, int n) {
  for (int i = 0; i < n; i++) {
    if (b[i] >= a[i]) return false;
  }
  return true;
}
int main() {
  int n;
  bool ans;
  cin >> n;
  string s;
  cin >> s;
  int a[n], b[n];
  for (int i = 0; i < n; i++) a[i] = s[i] - 48;
  for (int i = 0; i < n; i++) b[i] = s[i + n] - 48;
  sort(a, a + n);
  sort(b, b + n);
  if (a[0] > b[0])
    ans = compare(a, b, n);
  else
    ans = compare(b, a, n);
  if (ans)
    cout << "YES";
  else
    cout << "NO";
}
