#include <bits/stdc++.h>
using namespace std;
int vis[30];
char s[100100];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++)
    if (s[i] >= 'a' && s[i] <= 'z') {
      memset(vis, 0, sizeof(vis));
      while (s[i] >= 'a' && s[i] <= 'z') vis[s[i++] - 'a'] = 1;
      int cnt = 0;
      for (int j = 0; j < 26; j++)
        if (vis[j]) cnt++;
      ans = max(ans, cnt);
    }
  cout << ans << endl;
}
