#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  register T c = getchar();
  x = 0;
  int t = 0;
  if (c == '-') t = 1, c = getchar();
  for (; (c < 48 || c > 57); c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (t) x = -x;
}
int main() {
  int n, Max = 0;
  read(n);
  string str;
  cin >> str;
  bool visited[250] = {0};
  for (int i = 0; i < n; i++) {
    if (str[i] >= 'a' && !visited[i]) {
      set<char> s;
      visited[i] = 1;
      s.insert(str[i]);
      for (int j = i + 1; j < n; j++) {
        if (str[j] <= 'Z') break;
        visited[j] = 1;
        s.insert(str[j]);
      }
      if (Max < s.size()) Max = s.size();
    }
  }
  cout << Max;
}
