read n
read s
ans=0
for i in `seq $n`;do
	cnt=0
	for c in {a..z};do
		a=0
		b=0
		for k in `seq $n`;do
			if [[ $c = ${s:$k:1} ]];then
				if [ $k -lt $i ];then
					a=$[a+1]
				else
					b=$[b+1]
				fi
			fi
		done
		if [ $a -gt 0 -a $b -gt 0 ];then
			cnt=$[cnt+1]
		fi
	done
	if [ $ans -lt $cnt ];then
		ans=$cnt
	fi
done
echo $ans
