#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, i, a, b = -1, j;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int ct[26] = {0};
  for (i = 0; i < s.size(); i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      j = i;
      memset(ct, 0, sizeof(ct));
      while (j < s.size() && s[j] >= 'a' && s[j] <= 'z') {
        ct[s[j] - 'a'] = 1;
        j++;
      }
      int cur = 0;
      for (j = 0; j < 26; j++) {
        cur += ct[j];
      }
      ans = max(ans, cur);
    }
  }
  cout << ans;
  return 0;
}
