(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var n = read.number();
    var s = read.arr();

    for(var i = 0; i < n; i ++) {
        for(var j = i ; j < n; j++) {
            if(s[i] > s[j]) {
                print('YES');
                return;
            }
        }
    }
    print('NO');
}());
