#include <bits/stdc++.h>
using namespace std;
int a[123];
void ispis(int a[]) {
  for (int i = 0; i < 26; i++) printf("%d ", a[i]);
  cout << endl;
}
int main() {
  int n, cnt = 0, t = 0, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i <= n; i++) {
    if (islower(s[i]) && i != n) {
      a[s[i] - 97]++;
    } else {
      for (int j = 0; j < 26; j++) {
        if (a[j]) t++;
      }
      if (t > ans) ans = t;
      t = 0;
      memset(a, 0, sizeof(a));
    }
  }
  cout << ans;
  return 0;
}
