#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    m.clear();
    string s;
    cin >> s;
    int ans = 0, anss = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] >= 'A' && s[i] <= 'Z') {
        m.clear();
        anss = max(anss, ans);
        ans = 0;
        continue;
      } else if (s[i] >= 'a' && s[i] <= 'z') {
        if (m[s[i]] == 0) {
          ans++;
          anss = max(anss, ans);
          m[s[i]] = 1;
        }
      }
    }
    cout << anss << endl;
  }
}
