#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  scanf("%d ", &n);
  char s[207];
  gets(s);
  int i, c = 0, ans = 0;
  map<char, int> my;
  for (i = 0; i < n; i++) {
    if (s[i] <= 'Z') {
      my.clear();
      ans = max(ans, c);
      c = 0;
    } else {
      if (my[s[i]] == 0) c++;
      my[s[i]] = 1;
    }
  }
  ans = max(ans, c);
  cout << ans;
  return 0;
}
