
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main()
{
	auto n = readln.strip.to!int;
	auto s = readln.strip.map!( to!dchar ).array;
	auto result = 0;
	
	for( int index = 1; index < s.length - 1; index++ )
	{
		auto x = sort( s[ 0 .. index ].dup ).uniq;
		auto y = s[ index .. $ ];
		auto max = 0;
		
		if( x.walkLength < result ) continue;
		if( y.length < result ) break;
		
		foreach( xc; x )
		{
			if( y.find( xc ) != null ) max++;
		}
		
		if( result < max ) result = max;
	}
	
	writeln( result );
}
