#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0;
  cin >> n;
  string s;
  cin >> s;
  int a[n + 1], b[n + 1];
  for (int i = 0; i < s.length() / 2; i++) a[i] = s[i] - '0';
  sort(a, a + n);
  for (int i = s.length() / 2; i < s.length(); i++) b[k++] = s[i] - '0';
  sort(b, b + n);
  int t = 0, m = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < b[i]) t++;
    if (a[i] > b[i]) m++;
  }
  if (t == n || m == n)
    cout << "YES";
  else
    cout << "NO";
}
