#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  set<char> se;
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] >= 'a') {
      se.insert(s[i]);
      ans = max(ans, (long long)se.size());
    } else
      se.clear();
  }
  cout << ans << '\n';
}
