#include <bits/stdc++.h>
using namespace std;
int len;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> len >> s;
  int max_part = 0;
  for (int i = 0; i < len; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') continue;
    set<char> st;
    for (int j = i; j < len; j++) {
      if (s[j] >= 'A' && s[j] <= 'Z') break;
      st.insert(s[j]);
    }
    max_part = max(max_part, (int)st.size());
    st.clear();
  }
  cout << max_part << endl;
}
