#include <bits/stdc++.h>
using namespace std;
int n;
string str;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  cin >> str;
  int maxnum = 0, ans = 0;
  int arr[26] = {0};
  for (int i = 0; i < n; i++) {
    if (str[i] >= 'a' && str[i] <= 'z') {
      arr[str[i] - 'a']++;
    } else {
      for (int i = 0; i < 26; i++) {
        if (arr[i] > 0) ans++;
      }
      maxnum = max(maxnum, ans);
      ans = 0;
      memset(arr, 0, sizeof(arr));
    }
  }
  for (int i = 0; i < 26; i++) {
    if (arr[i] > 0) ans++;
  }
  maxnum = max(ans, maxnum);
  cout << maxnum << '\n';
  return 0;
}
