#include <bits/stdc++.h>
using namespace std;
string sss = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
long long kyta[1000];
void solve(long long CS) {
  set<long long> st;
  string str;
  long long l, i, j, mx = 0;
  cin >> l >> str;
  for (i = 0; i < l; i++) {
    long long now = (int)str[i];
    if (now >= 65 && now <= 90) {
      mx = max(mx, (long long)st.size());
      st.clear();
      continue;
    }
    st.insert(now);
  }
  mx = max(mx, (long long)st.size());
  cout << mx;
}
int main() {
  long long t, no = 0;
  t = 1;
  while (t--) solve(++no);
}
