#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 200;
char s[MAXLEN + 1];
int n;
void run() {
  scanf("%d%s", &n, s);
  n = strlen(s);
  int ret = 0;
  for (int at = 0, to = at; at < n; at = to) {
    if (isupper(s[to])) {
      ++to;
      continue;
    }
    while (to < n && islower(s[to])) ++to;
    int mask = 0, cnt = 0;
    for (int i = (at); i < (to); ++i) {
      int x = s[i] - 'a';
      if (((mask >> x) & 1) == 0) mask |= 1 << x, ++cnt;
    }
    ret = max(ret, cnt);
  }
  printf("%d\n", ret);
}
int main() {
  run();
  return 0;
}
