#include <bits/stdc++.h>
using namespace std;

int n, m = 0;
string s;

int main() {
	cin >> n >> s;
	for (int i = 1, l, r; i < n; i++) { //[0,i-1].[i,n-1]
		l = 0, r = 0;
		for (int j = 0; j < n; j++) {
			if (j < i)
				l |= 1 << s[j] - 'a';
			else
				r |= 1 << s[j] - 'a';
		}
		m = max(m, __builtin_popcount(l & r));
	}
	cout << m << endl;
}
