#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char c[210];
  int a[30];
  memset(a, 0, sizeof(a));
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    scanf("%c", &c[i]);
  }
  int maxn = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    if (!isupper(c[i]))
      a[c[i] - 'a']++;
    else if (isupper(c[i])) {
      for (int i = 0; i <= 29; i++)
        if (a[i]) sum++;
      memset(a, 0, sizeof(a));
    }
    if (i == n) {
      for (int i = 0; i <= 29; i++)
        if (a[i]) sum++;
    }
    if (maxn < sum) maxn = sum;
    sum = 0;
  }
  printf("%d\n", maxn);
  return 0;
}
