import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

void main() {
    int n = readint();
    string s = readln.chomp;
    
    int ans;
    foreach (i; 1..n) {
        auto a = s[0..i];
        auto b = s[i..n].dup.array.sort().release.uniq;
        int cnt = b.filter!(c => count(a, c) > 0)
            .array
            .length
            .to!int;
        ans = max(ans, cnt);
    }
    writeln(ans);

    string _ = readln;
}
