#include <bits/stdc++.h>
using namespace std;
int n;
int a[1002], b[1002];
void sort1(int x[]) {
  for (int i = 1; i <= n - 1; i++)
    for (int j = i + 1; j <= n; j++) {
      if (x[i] > x[j]) {
        int z = x[i];
        x[i] = x[j];
        x[j] = z;
      }
    }
}
int main() {
  while (cin >> n) {
    string q;
    cin >> q;
    for (int i = 0; i <= n - 1; i++) {
      a[i + 1] = q[i] - '0';
    }
    for (int j = n; j < 2 * n; j++) {
      b[j + 1 - n] = q[j] - '0';
    }
    sort1(a);
    sort1(b);
    bool flag = 1;
    int d = a[1] - b[1];
    if (d == 0) {
      cout << "NO" << endl;
    } else {
      for (int i = 2; i <= n; i++) {
        int z = a[i] - b[i];
        if (z == 0) {
          flag = 0;
          break;
        }
        if (d > 0) {
          if (z < 0) {
            flag = 0;
            break;
          }
        } else if (z > 0) {
          flag = 0;
          break;
        }
      }
      if (flag)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
