#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500000;
const int SUPERN = 5000000;
const int MAXS = 325;
const int SUPERS = 1000;
const int MD = 1e9 + 7;
int n, re;
string s;
set<char> sc;
long long sum(long long a, long long b) { return (a + b) % MD; }
long long mu(long long a, long long b) { return (a * b) % MD; }
long long mn(long long a, long long b) { return (a - b + MD) % MD; }
int main() {
  cin >> n >> s;
  for (auto u : s) {
    if (u >= 'a' && u <= 'z') {
      sc.insert(u);
    } else {
      re = max(re, (int)sc.size());
      sc.clear();
    }
  }
  re = max(re, (int)sc.size());
  cout << re;
  return 0;
}
