#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 50 + 10;
set<int> st;
set<int>::iterator it;
map<char, int> mp;
string s;
int main() {
  int n, maxs = 0, ns = 0;
  scanf("%d", &n);
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z' && mp[s[i]] == 0) {
      mp[s[i]] = 1;
      ns++;
    }
    if ((s[i] >= 'A' && s[i] <= 'Z') || (i == n - 1)) {
      maxs = max(maxs, ns);
      ns = 0;
      mp.clear();
    }
  }
  printf("%d\n", maxs);
  return 0;
}
