#include <bits/stdc++.h>
using namespace std;
int g[300];
int main() {
  int kmax = 0, n, i, k = 0, j = 0;
  char c[300];
  cin >> n;
  cin >> c;
  for (i = 0; i < n; i++) {
    if (c[i] > 64 && c[i] < 91) {
      j = 0;
      if (k > kmax) kmax = k;
      k = 0;
      memset(g, 0, sizeof(g));
    } else if (g[c[i] - '0'] == 0) {
      g[c[i] - '0'] = 1;
      k++;
    }
  }
  if (k > kmax) kmax = k;
  cout << kmax;
}
