#include <iostream>
using namespace std;

int main() {
	int n; string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		int cnt = 0;
		bool used[26] = {false};
        for (int j = 0; j < i; j++) used[s[j] - 'a'] = true;
        for (int j = i; j < n; j++) {
			if (used[s[j] - 'a']) {
				used[s[j] - 'a'] = false;
				cnt++;
			}
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}