inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
S = inp.shift()

x = []
y = []
a = {}
b = {}

for (i=0;i<N;i++) {
    a[S[i]] = 1
    b[S[N-i-1]] = 1
    x[i] = Object.keys(a).sort()
    y[N-i-1] = Object.keys(b).sort()
}
max = 0
for (i=0; i<N-1; i++) {
    k = 0
    cnt = 0
    for (j=0;j<x[i].length && k<y[i+1].length; j++) {
        if (y[i+1].indexOf(x[i][j]) >= 0) {
            cnt++
        }
    }
    if (max < cnt) {
        max = cnt
    }
}
console.log(max)