#include <bits/stdc++.h>
using namespace std;
int ans, temp, sum, l1;
string s;
bool cek[250];
int main() {
  memset(cek, 0, sizeof(cek));
  cin >> l1;
  cin >> s;
  for (int i = 0; i < l1; i++) {
    if (isupper(s[i])) {
      memset(cek, 0, sizeof(cek));
      temp = i;
      sum = 0;
    } else if (cek[s[i]] == 0) {
      sum++;
      cek[s[i]] = 1;
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
}
