#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n], b[n];
    string z;
    cin >> z;
    for (int i = 0; i < n; i++) {
      a[i] = (int)z[i] - 48;
      b[i] = (int)z[i + n] - 48;
    }
    sort(a, a + n);
    sort(b, b + n);
    if (a[0] < b[0]) {
      for (int i = 1; i < n; i++) {
        if (a[i] >= b[i]) {
          cout << "NO";
          return 0;
        }
      }
      cout << "YES";
    } else if (a[0] > b[0]) {
      for (int i = 1; i < n; i++) {
        if (a[i] <= b[i]) {
          cout << "NO";
          return 0;
        }
      }
      cout << "YES";
    } else if (a[0] == b[0])
      cout << "NO";
  }
  return 0;
}
