#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
//#define MAX 300000
int main()
{
	int i;
	int max, count1, count2;
	int num1[26], num2[26], n;
	char s[105];
	while(scanf("%d", &n) != EOF){
		max = count1 = count2 = 0;
		for (i = 0; i < 26; i++)
			num1[i] = num2[i] = 0;
		scanf("%s", s);
		for (i = 0; i < n; i++){
			num2[s[i] - 'a']++;
		}
		for (i = 0; i < 26; i++)
			if(num2[s[i] - 'a'])
				count2++;
		
		for (i = 0; i < n; i++){
			if(num1[s[i] - 'a'] == 0 && num2[s[i] - 'a'] > 1){
				count1++;
			}else if(num1[s[i] - 'a'] > 0 && num2[s[i] - 'a'] == 1){
				count1--;
			}
			if(max < count1)
				max = count1;
			num2[s[i] - 'a']--;
			num1[s[i] - 'a']++;
		}
		
		printf("%d\n", max);
	}
    return 0;
}
