#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  set<char> S;
  int ans = 0;
  for (int i = 0; i <= s.size(); ++i) {
    if (i == s.size() || isupper(s[i])) {
      ans = max(ans, (int)S.size());
      S.clear();
    } else {
      S.insert(s[i]);
    }
  }
  cout << ans << endl;
  return 0;
}
