#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  set<char> uni;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z')
      uni.insert(s[i]);
    else {
      ans = max(ans, (int)uni.size());
      uni.clear();
    }
  }
  ans = max(ans, (int)uni.size());
  cout << ans << endl;
}
