#!/bin/sh

read N
read S

chars=$(echo $S | grep -o . | sort | uniq | tr "\n" " ")
max=0

for i in `seq $(($N-1))`
do
        j=$((i+1))
        X=$(echo $S | cut -c 1-$i )
        Y=$(echo $S | cut -c $j-$N)

        sum=0
        for c in `echo $chars`
        do

                [ ! $(echo $X | grep $c) = "" ] && [ ! $(echo $Y | grep $c) = "" ]  && sum=$((sum+1))

                #echo "$X:$Y c=$c,cinX=$cinX,cinY=$cinY"
        done

        [ $sum -gt $max ] && max=$sum

        #echo "sum:$sum"

done

echo $max