_,s=io.read("*l","*l")
Max=0
for i=1,#s-1 do
	a,cnt={},0
	for j=1,i do
		a[s:sub(j,j)]=1
	end
	for j=i+1,#s do
		if a[s:sub(j,j)]then
			cnt=cnt+1 a[s:sub(j,j)]=nil
		end
	end
	Max=math.max(Max,cnt)
end
print(Max)