#include <bits/stdc++.h>
using namespace std;
inline void rvi(vector<int>& a) {
  for (int i = 0; i < a.size(); ++i) scanf("%d", &a[i]);
}
inline void rvu(vector<unsigned long long>& a) {
  for (int i = 0; i < a.size(); ++i) scanf("%llu", &a[i]);
}
int main() {
  string s;
  int n;
  cin >> n >> s;
  size_t m = 0;
  for (int i = 0; i < n; ++i) {
    set<char> have;
    if (s[i] - 'a' > 25 || s[i] - 'a' < 0) continue;
    have.insert(s[i]);
    for (int j = i + 1; j < n; ++j) {
      if ((s[j] - 'a' > 25 || s[j] - 'a' < 0)) {
        break;
      }
      if (have.find(s[j]) == have.end()) have.insert(s[j]);
    }
    m = max(m, have.size());
  }
  cout << m << endl;
}
