#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, less = 0, greater = 0;
  string s;
  cin >> n;
  cin >> s;
  int l[n], r[n], j = n;
  for (int i = 0; i < n; i++) {
    l[i] = s[i] - '0';
    r[i] = s[j] - '0';
    j++;
  }
  sort(l, l + n);
  sort(r, r + n);
  for (int i = 0; i < n; i++) {
    if (l[i] > r[i]) {
      greater++;
    }
    if (l[i] < r[i]) {
      less++;
    }
  }
  if (less == n || greater == n) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
