#include <bits/stdc++.h>
using namespace std;
long long n, i, j, ans, sum, n1, l, r, a[500009];
map<char, long long> m;
string second, s1;
char c;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  cin >> second;
  ans = 0;
  second += 'A';
  for (int i1 = 0; i1 <= n; i1++) {
    sum = 0;
    if (second[i1] - 'a' >= 0 && second[i1] - 'a' < 26)
      s1 += second[i1];
    else {
      for (i = 0; i < s1.size(); i++) {
        m[s1[i]]++;
      }
      sum = 0;
      c = 'a';
      for (i = 0; i < 26; i++) {
        if (m[c] > 0) sum++;
        c++;
      }
      ans = max(ans, sum);
      c = 'a';
      for (i = 0; i < 26; i++) {
        m[c] = 0;
        c++;
      }
      s1 = "";
    }
  }
  cout << ans << endl;
  return 0;
}
