#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j = 0, n, k, maxi = 0, start, flag = 0, ram = 0;
  cin >> n;
  char s[205];
  char s1[205];
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 97 && s[i] <= 122) {
      s1[0] = s[i];
      start = i + 1;
      j = 1;
      maxi = 1;
      break;
    }
  }
  if (start > n) return cout << 0, 0;
  for (int i = start; i < n; i++) {
    if (s[i] >= 97 && s[i] <= 122 && j == 0) {
      s1[j] = s[i];
      j++;
    } else if (s[i] >= 97 && s[i] <= 122) {
      for (k = 0; k <= j - 1; k++) {
        flag = 0;
        if (s1[k] == s[i]) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        s1[j] = s[i];
        j++;
        maxi = max(maxi, j);
      }
    } else if (s[i] >= 65 && s[i] <= 90) {
      j = 0;
    }
  }
  cout << maxi;
  return 0;
}
