#include <bits/stdc++.h>
using namespace std;
int n, ans;
char inp[202];
vector<bool> cnts;
void eval_cnts() {
  int cnd = 0;
  for (int i = 0; i < 27; i++) {
    if (cnts[i]) cnd++;
  }
  ans = max(ans, cnd);
}
int main() {
  scanf("%d %s", &n, inp);
  cnts = vector<bool>(27, false);
  for (int i = 0; inp[i]; i++) {
    if (inp[i] >= 'A' && inp[i] <= 'Z') {
      eval_cnts();
      cnts = vector<bool>(27, false);
    } else
      cnts[inp[i] - 'a'] = true;
  }
  eval_cnts();
  printf("%d", ans);
}
