#include <bits/stdc++.h>
using namespace std;
int n, Max, c;
set<char> st;
string s;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    c = 0;
    st.clear();
    for (int j = i; j < n; ++j) {
      if (isupper(s[j])) break;
      st.insert(s[j]);
      Max = max(Max, (int)st.size());
    }
  }
  cout << Max << endl;
  return 0;
}
