process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var n = parseInt(input[0], 10);
    var s = input[1].split('');

    var rightCharCount = {};
    var leftCharCount = {};

    for (var i = 0; i < n; i++) {

        if (s[i] in rightCharCount) {
            rightCharCount[s[i]]++;
        }
        else {
            rightCharCount[s[i]] = 1;
            leftCharCount[s[i]] = 0;
        }
    }

    var both = 0;
    var ans = 0;

    for (var i = 0; i < n; i++) {

        leftCharCount[s[i]]++;
        if (leftCharCount[s[i]] === 1) {
            both++;
        }

        rightCharCount[s[i]]--;
        if (rightCharCount[s[i]] === 0) {
            both--;
        }

        ans = Math.max(ans, both);
    }

    console.log(ans);

    return 0;
}
