#include <bits/stdc++.h>
#define int long long int
using namespace std;

main() {
	// your code goes here
	int n;cin>>n;
	string s;
	cin>>s;string t=s;
	sort(s.begin(),s.end());
	if(s==t)cout<<"NO";
	else cout<<"YES";
	return 0;
}