#include <bits/stdc++.h>
using namespace std;
int n, mx, bas = 1, h[50];
char a[1000005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] <= 'z' and a[i] >= 'a') {
      h[a[i] - 'a']++;
      continue;
    }
    if (a[i] >= 'A' and a[i] <= 'Z') {
      int ans = 0;
      for (int i = 0; i <= 50; i++)
        if (h[i]) ans++;
      mx = max(mx, ans);
      memset(h, 0, sizeof(h));
    }
  }
  int ans = 0;
  for (int i = 0; i <= 50; i++)
    if (h[i]) ans++;
  mx = max(mx, ans);
  memset(h, 0, sizeof(h));
  cout << mx;
  return 0;
}
