#include <bits/stdc++.h>
using namespace std;
int main() {
  set<char> S;
  int n;
  cin >> n;
  string A;
  cin >> A;
  int mx = 0;
  for (int i = 0; i < A.size(); i++) {
    if ('A' <= A[i] && A[i] <= 'Z') {
      int sz = S.size();
      mx = max(mx, sz);
      S.clear();
    } else
      S.insert(A[i]);
  }
  int sz = S.size();
  cout << max(mx, sz) << endl;
}
