#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long

signed main() {
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		vector<int>c1(26), c2(26);
		rep(j, i)c1[s[j] - 'a']++;
		for (int j = i; j < n; j++)c2[s[j] - 'a']++;
		int res = 0;
		rep(j, 26)if (c1[j] && c2[j])res++;
		ans = max(ans, res);
	}
	cout << ans << endl;
}