#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(int n, int i) { return n & ((int)1 << i); }
inline int setBit(int n, int i) {
  return n | ((int)1 << i);
  ;
}
inline int resetBit(int n, int i) { return n & (~((int)1 << i)); }
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(int year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(int &a) { a = (a + 1000000007) % 1000000007; }
inline int modMul(int a, int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline int modAdd(int a, int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline int modSub(int a, int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline int modPow(int b, int p) {
  int r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline int modInv(int a) { return modPow(a, 1000000007 - 2); }
inline int modDiv(int a, int b) { return modMul(a, modInv(b)); }
inline int fact(int r) {
  int ans = 1;
  while (r) ans = modMul(ans, r), r--;
  return ans;
}
inline int invfact(int r) {
  int ans = 1;
  while (r) ans = modMul(ans, modInv(r)), r--;
  return ans;
}
inline double dgcd(double a, double b) {
  if (a < b) return dgcd(b, a);
  if (b < .0001) return a;
  return dgcd(b, fmod(a, b));
}
void solve() {
  int n, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    int k = i;
    int cnt[26] = {0};
    while (i < n && s[i] >= 'a' && s[i] <= 'z') {
      cnt[s[i] - 'a']++;
      i++;
    }
    if (s[k] >= 'a' && s[k] <= 'z') {
      int temp = 0;
      for (int i = 0; i < 26; i++) {
        temp += (cnt[i] > 0);
      }
      ans = max(ans, temp);
      i--;
    }
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
}
