#include <bits/stdc++.h>
using namespace std;
bool mark1[205];
int main() {
  int n;
  char ch[205];
  bool mark[205];
  scanf("%d", &n);
  scanf("%s", ch);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int tot = 0;
    memset(mark, false, sizeof(mark));
    for (int j = i; j < n; j++) {
      if (ch[j] <= 'Z' && ch[j] >= 'A') {
        break;
      }
      if (!mark[ch[j] - 'a']) {
        tot++;
      }
      mark[ch[j] - 'a'] = true;
    }
    ans = max(tot, ans);
  }
  printf("%d\n", ans);
}
