#include <bits/stdc++.h>
void swap(int* a, int* b) {
  int t = *a;
  *a = *b;
  *b = t;
}
int partition(int arr[], int low, int high) {
  int pivot = arr[high];
  int i = (low - 1);
  for (int j = low; j <= high - 1; j++) {
    if (arr[j] < pivot) {
      i++;
      swap(&arr[i], &arr[j]);
    }
  }
  swap(&arr[i + 1], &arr[high]);
  return (i + 1);
}
void quickSort(int arr[], int low, int high) {
  if (low < high) {
    int pi = partition(arr, low, high);
    quickSort(arr, low, pi - 1);
    quickSort(arr, pi + 1, high);
  }
}
int main() {
  int num, cont_aux, digitos;
  int cont_L, cont_E, cont_R;
  scanf("%d", &digitos);
  char numero[2 * digitos + 1];
  int vect1[digitos], vect2[digitos];
  scanf("%s", numero);
  cont_aux = 0;
  while (cont_aux < 2 * digitos) {
    num = numero[cont_aux] - '0';
    if (cont_aux < digitos) {
      vect1[cont_aux] = num;
    } else if (cont_aux >= digitos) {
      vect2[cont_aux - digitos] = num;
    }
    cont_aux++;
  }
  quickSort(vect1, 0, digitos - 1);
  quickSort(vect2, 0, digitos - 1);
  cont_aux = 0;
  cont_L = cont_E = cont_R = 0;
  for (cont_aux = 0; cont_aux < digitos; cont_aux++) {
    if (vect1[cont_aux] > vect2[cont_aux]) {
      cont_L++;
    } else if (vect1[cont_aux] == vect2[cont_aux]) {
      cont_E++;
    } else if (vect1[cont_aux] < vect2[cont_aux]) {
      cont_R++;
    }
  }
  if (cont_L == digitos || cont_R == digitos) {
    printf("YES");
  } else {
    printf("NO");
  }
}
