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

/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}

/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

void main() {
    const n = readNum();
    const s = readRows(1)[0];
    size_t maxCount = 0;
    foreach(i; 0 .. s.length) {
        bool[dchar] leftSet;
        bool[dchar] rightSet;
        s[0 .. i].each!(c => leftSet[c] = true);
        s[i .. $].each!(c => rightSet[c] = true);
        maxCount = max(maxCount, leftSet.keys.filter!(k => k in rightSet).count);
    }
    writefln("%s", maxCount);
}