#include <bits/stdc++.h>
int n;
char s[300];
int ans = 0;
int check(int a, int b) {
  bool xx[27];
  memset(xx, 0, sizeof(xx));
  for (int i = a; i <= b; i++) {
    xx[s[i] - 'a'] = true;
  }
  int sum = 0;
  for (int i = 0; i < 26; i++)
    if (xx[i]) sum++;
  return sum;
}
using namespace std;
int main() {
  cin >> n;
  s[0] = '!';
  getchar();
  if (n == 1) {
    char c;
    scanf("\n%c", &c);
    if (c >= 'A' && c <= 'Z') {
      printf("0");
      return 0;
    }
    printf("1");
    return 0;
  }
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    char c;
    scanf("%c", &c);
    if (c == s[flag - 1]) continue;
    s[flag++] = c;
  }
  for (int i = 1; i < flag; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      continue;
    }
    int j;
    for (j = i; j < flag; j++) {
      if (s[j] >= 'A' && s[j] <= 'Z') break;
    }
    j--;
    ans = max(ans, check(i, j));
  }
  printf("%d", ans);
  return 0;
}
