#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, k, n, rev = 0, r, c1 = 0, c2 = 0, x, z, a[1000], ans = 0;
  string s;
  set<char> ch;
  cin >> n >> s;
  for (i = 0; i < n; i++) {
    if (s[i] > 96) {
      ch.insert(s[i]);
    } else {
      x = ch.size();
      ans = max(ans, x);
      ch.clear();
    }
  }
  x = ch.size();
  if (x != 0) {
    ans = max(ans, x);
  }
  cout << ans;
  return 0;
}
