#include <bits/stdc++.h>
using namespace std;
bool vis[500];
int main() {
  int n, ans = 0;
  char s[2005];
  cin >> n;
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] >= 'A' && s[i] <= 'Z') continue;
    int rg = i, tot = 0;
    while ((s[rg] < 'A' || s[rg] > 'Z') && rg <= n) {
      if (!vis[s[rg] - 'a']) ++tot;
      vis[s[rg] - 'a'] = 1;
      ++rg;
    }
    ans = max(ans, tot);
    memset(vis, 0, sizeof(vis));
    i = rg;
  }
  cout << ans << endl;
  return 0;
}
