#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  string s;
  cin >> s;
  int cnt = 0, ans = 0, f[26] = {0};
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      if (!f[s[i] - 'a']) {
        cnt++;
        f[s[i] - 'a']++;
      }
      ans = max(cnt, ans);
    } else {
      memset(f, 0, sizeof(f));
      cnt = 0;
    }
  }
  cout << ans;
}
