#include <bits/stdc++.h>
using namespace std;
char s[1010];
int a[50];
int main() {
  int n, ans = 0;
  cin >> n;
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    if (s[i] <= 'z' && s[i] >= 'a') {
      a[s[i] - 'a']++;
    } else {
      int cnt = 0;
      for (int i = 0; i < 26; i++)
        if (a[i]) {
          cnt++;
          a[i] = 0;
        }
      ans = max(ans, cnt);
    }
  }
  int cnt = 0;
  for (int i = 0; i < 26; i++)
    if (a[i]) {
      cnt++;
      a[i] = 0;
    }
  ans = max(ans, cnt);
  cout << ans << endl;
  return 0;
}
