#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (size_t i = 0; i < n; i++) {
    vector<bool> v(26, 0);
    int x = 0;
    for (; s[i] <= 'z' && s[i] >= 'a' && i < n; i++) {
      int j = int(s[i]) - int('a');
      if (!v[j]) {
        v[j] = 1;
        x++;
      }
    }
    ans = max(ans, x);
  }
  cout << ans;
  return 0;
}
