#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  char s[300];
  scanf("%d", &n);
  scanf("%s", s);
  bool vis[30];
  memset(vis, 0, sizeof vis);
  int maks = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      if (!vis[s[i] - 'a']) {
        vis[s[i] - 'a'] = 1;
        ans++;
      }
    } else {
      if (maks < ans) maks = ans;
      memset(vis, 0, sizeof vis);
      ans = 0;
    }
  }
  if (ans > maks) maks = ans;
  printf("%d\n", maks);
  return 0;
}
