#include<iostream>
#include<string>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for(int i = 1; i < n; i++){
    int a[26] = {};
    for(int j = 0; j < i; j++)a[s[j]-'a']++;
    int b[26] = {};
    for(int j = i; j < n; j++)b[s[j]-'a']++;
    int tmp = 0; 
    for(int j = 0; j < 26; j++)if(a[j] && b[j]) tmp++;
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}