#include <bits/stdc++.h>
using namespace std;
int main(){
  int ans = 0;
  int n; cin >> n;
  string s; cin >> s;
  for(int i = 0; i < n; i++){
  	int msk1 = 0, msk2 = 0;
    for(int j = 0; j <= i; j++) msk1 |= 1<<(s[j] - 'a');
    for(int j = i + 1; j < n; j++) msk2 |= 1<<(s[j] - 'a');
    ans = max(ans, __builtin_popcount(msk1&msk2));
  }
  cout << ans << endl;
  return 0;
}