#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int sum = 1, i = 0, j, n, e = 0, t = 0, x, y, h = 0, f, l = 0,
                k = 0, x1, x2, y1, y2, m;
  cin >> n;
  string s;
  cin >> s;
  sort(s.begin(), s.begin() + n);
  sort(s.begin() + n, s.end());
  for (i = 0; i < n; i++) {
    if (s[i] < s[n + i]) l++;
    if (s[i] > s[n + i]) k++;
  }
  if (l == n || k == n)
    cout << "YES";
  else
    cout << "NO";
}
