#include <bits/stdc++.h>
using namespace std;
int n, a[200002] = {0}, b[200002] = {0}, m[200002] = {0}, k, i,
       flag[200002] = {0};
int main() {
  int n, i;
  char s[202] = {'\0'};
  int maxi = 0;
  map<char, int> m;
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      if (maxi < m.size()) {
        maxi = m.size();
      }
      m.clear();
    } else if (s[i] >= 'a' && s[i] <= 'z') {
      m[s[i]]++;
      if (m.size() > maxi) {
        maxi = m.size();
      }
    }
  }
  cout << maxi;
  return 0;
}
