#include <bits/stdc++.h>
int n;
std::string s;
std::vector<std::string> list;
int ans;
int main() {
  std::cin >> n >> s;
  std::string temp;
  for (int i = 0; i < s.length(); ++i) {
    if ('A' <= s[i] && s[i] <= 'Z') {
      list.push_back(temp);
      temp.clear();
      continue;
    }
    temp += s[i];
  }
  list.push_back(temp);
  for (auto i : list) {
    std::set<char> ou;
    for (auto c : i) {
      ou.insert(c);
    }
    ans = std::max(ans, (signed)ou.size());
  }
  std::cout << ans << std::endl;
  return 0;
}
