#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max = 0;
  string s;
  cin >> n;
  cin >> s;
  int i = 0;
  int cur = 0;
  vector<bool> letters;
  letters.assign(33, false);
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      if (!letters[(int)(s[i] - 'a')]) {
        cur++;
        letters[(int)(s[i] - 'a')] = true;
      }
    } else {
      if (max < cur) max = cur;
      letters.assign(33, false);
      cur = 0;
    }
  }
  if (max < cur) max = cur;
  cout << max;
  return 0;
}
