#include <bits/stdc++.h>
using namespace std;
const int mod = 1E9 + 7;
const double eps = 1e-6;
template <typename T>
T abs(T val) {
  return val > 0 ? val : -val;
}
template <class T>
inline void read(T &ret) {
  char c;
  ret = 0;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') ret = ret * 10 + (c - '0'), c = getchar();
}
template <class T>
inline void out(T x) {
  if (x > 9) out(x / 10);
  putchar(x % 10 + '0');
}
char str[202];
int vis[26];
inline bool check(char ch) {
  if (ch >= 'a' && ch <= 'z')
    return true;
  else
    return false;
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    scanf("%s", str);
    int ans = 0;
    int tmp = 0;
    for (int i = 0; i < n; i++) {
      if (!check(str[i])) {
        ans = max(ans, tmp);
        tmp = 0;
        memset(vis, 0, sizeof(vis));
      } else {
        int v = str[i] - 'a';
        if (!vis[v]) vis[v] = 1, tmp++;
      }
    }
    ans = max(ans, tmp);
    printf("%d\n", ans);
  }
}
