#include <bits/stdc++.h>
using namespace std;
const int dr[] = {-1, 1, 0, 0};
const int dc[] = {0, 0, -1, 1};
const int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int kr[] = {1, 1, -1, -1, 2, 2, -2, -2};
const int kc[] = {2, -2, 2, -2, 1, -1, 1, -1};
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
void check_time() {}
const int res = 1e5 + 10;
const long long int mod = 1e9 + 7;
int main() {
  int n, sum, total, ans, len, digit = 0, maxi = 0;
  string s;
  map<char, int> m;
  scanf("%d", &n);
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 'a' and s[i] <= 'z') {
      char ch = s[i];
      if (m[ch] == 0) {
        digit++;
        m[ch] = 1;
      }
      maxi = max(maxi, digit);
    } else if (s[i] >= 'A' and s[i] <= 'Z') {
      char ch = s[i];
      digit = 0;
      m.clear();
    }
  }
  deb(maxi);
  return 0;
}
