#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, A[210];
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < 2 * n; ++i) {
    A[i] = int(s[i] - '0');
  }
  int a1[n + 2], a2[n + 2], j = 0, k = 0, g = 0, l = 0;
  for (int i = 0; i < 2 * n; ++i) {
    if (i < 2 * n / 2) {
      a1[j++] = A[i];
    } else {
      a2[k++] = A[i];
    }
  }
  sort(a1, a1 + n);
  sort(a2, a2 + n);
  for (int i = 0; i < n; ++i) {
    if (a1[i] > a2[i]) {
      g++;
    } else if (a1[i] < a2[i]) {
      l++;
    }
  }
  if (l == n || g == n) {
    cout << "YES";
  } else
    cout << "NO";
  return 0;
}
