#include <bits/stdc++.h>
using namespace std;
int n, mx = -1e9;
string s;
int findAns(string tmp) {
  set<char> t;
  for (int i = 0; i < tmp.size(); ++i) {
    t.insert(tmp[i]);
  }
  return t.size();
}
void solve() {
  string tmp = "";
  for (int i = 0; i < n; ++i) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      mx = max(mx, findAns(tmp));
      tmp = "";
      continue;
    }
    tmp += s[i];
  }
  mx = max(mx, findAns(tmp));
  cout << mx;
}
int main() {
  cin >> n >> s;
  solve();
  return 0;
}
