read n
read S
ans=0
for i in `seq $n`;do
	s=(`echo ${S:0:$[i-1]}|grep -o .|sort -u`)
	t=(`echo ${S:$i}|grep -o .|sort -u`)
	cnt=0
	for c in ${s[@]};do
		for d in ${t[@]};do
			if [ $c = $d ];then
				cnt=$[cnt+1]
				break
			fi
		done
	done
	ans=$[ans<cnt?cnt:ans]
done
echo $ans
