#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int inf = 0x3fffffff;
long long mod = 1000000007;
set<char> st;
int main() {
  int ans = 0;
  int n;
  string s;
  cin >> n >> s;
  for (int(i) = (0); (i) < (n); ++(i)) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      st.insert(s[i]);
    } else {
      ans = max(ans, (int)st.size());
      st.clear();
    }
  }
  ans = max(ans, (int)st.size());
  cout << ans << endl;
  return 0;
}
