#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int x, a[100], answer = 0;
	cin >> x;
	for (int i = 1; i <= 2 * x; i++) {
		char c;
		cin >> c;
		a[i] = c - '0';
	}
	sort(a + 1, a + x + 1);
	sort(a + x + 1, a + 2 * x + 1);
	for (int i = 1; i <= x; i++) {
		if (a[i] > a[i + x])
			answer++;
		if (a[i] < a[i + x])
			answer--;
	}
	if (answer == x || answer == -x)
		cout << "YES";
	else
		cout << "NO";
	return 0;
}