#include <bits/stdc++.h>
std::set<char> was;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int n;
  std::string str;
  std::cin >> n >> str;
  int best = 0;
  for (int i = 0; i < (n); ++i) {
    if ((int)str[i] >= (int)'a')
      was.insert(str[i]);
    else {
      best = std::max(best, (int)(was).size());
      was.clear();
    }
  }
  best = std::max(best, (int)(was).size());
  std::cout << best << "\n";
  return 0;
}
