#include <bits/stdc++.h>
using namespace std;
const int N = 205;
int cnt[30];
char s[N];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s + 1);
  int res = 0;
  s[0] = 'A';
  s[++n] = 'A';
  for (int i = 0; i <= n; ++i) {
    if (s[i] >= 'a' && s[i] <= 'z') continue;
    int j = i + 1;
    set<char> st;
    while (j <= n && s[j] >= 'a' && s[j] <= 'z') st.insert(s[j]), ++j;
    --j;
    i = j;
    res = max(res, (int)st.size());
  }
  printf("%d\n", res);
  return 0;
}
