#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int maxL = 0;
  for (int i = 0; i < n; i++) {
    int st;
    if (s[i] > 96) {
      set<char> m;
      int count = 0;
      while (s[i] > 96) {
        if (m.find(s[i]) == m.end()) {
          m.insert(s[i]);
          count++;
        }
        i++;
        if (i == n) break;
      }
      if (count > maxL) maxL = count;
    }
  }
  cout << maxL;
  return 0;
}
