#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0, fl = 0, c = 0;
  int pre[30] = {};
  for (int i = 0; i < n; i++) {
    if (fl == 0 && s[i] - 'a' >= 0 && s[i] - 'a' < 26) {
      for (int j = 0; j < 26; j++) pre[j] = 0;
      pre[s[i] - 'a']++;
      c = 1;
      fl = 1;
    } else if (s[i] - 'a' >= 0 && s[i] - 'a' < 26) {
      if (pre[s[i] - 'a'] == 0) pre[s[i] - 'a']++, c++;
    } else {
      fl = 0;
      ans = max(ans, c);
      c = 0;
    }
  }
  ans = max(ans, c);
  cout << ans << endl;
  return 0;
}
