'use strict'

function main(input) {

    input = input.split('\n')
    let ary = input[1].split('')
    let a, b = [];
    let max = 0 //answer
    let matched = {};

    // for (let i = ary.length; i >= 0; i--) {
    for (let i = 0; i < ary.length; i++) {
        //i の位置で配列を分割
        a = ary.slice(0, i)
        b = ary.slice(i, ary.length)

        if (i >= max) { // max が 配列数より大きかったらスキップ

            matched = {}

            for (let j = 0; j < i; j++) {
                b.find(element => {

                    if (element == a[j]) {
                        matched[a[j]] = true
                    }
                })
            }

            max = (max > Object.keys(matched).length) ? max : Object.keys(matched).length
        }

    }
    console.log(max)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));