#include <bits/stdc++.h>
using namespace std;
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
void print_vars(ostream&) {}
template <typename Car, typename... Cdr>
void print_vars(ostream& os, const Car& car, const Cdr&... cdr) {
  print_vars(os << car << (sizeof...(cdr) ? "," : ""), cdr...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << '(' << p.first << ',' << p.second << ')';
}
template <int I, typename Tuple>
void print_tuple(ostream&, const Tuple&) {}
template <int I, typename Car, typename... Cdr, typename Tuple>
void print_tuple(ostream& os, const Tuple& t) {
  os << get<I>(t) << (sizeof...(Cdr) ? "," : "");
  print_tuple<I + 1, Cdr...>(os, t);
}
template <typename... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  print_tuple<0, Args...>(os << '(', t);
  return os << ')';
}
template <typename Ch, typename Tr, typename C>
basic_ostream<Ch, Tr>& operator<<(basic_ostream<Ch, Tr>& os, const C& c) {
  os << '[';
  for (auto i = begin(c); i != end(c); ++i)
    os << (i == begin(c) ? "" : " ") << *i;
  return os << ']';
}
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  constexpr char endl = '\n';
  for (int n; cin >> n && n;) {
    string s;
    cin >> s;
    int res = 0;
    for (int i = int(0); i < int(n); i++)
      for (int j = int(i); j < int(n); j++) {
        set<char> cs(begin(s) + i, begin(s) + j + 1);
        bool ok = true;
        for (int k = int(0); k < int(26); k++) ok &= cs.count('A' + k) == 0;
        if (ok) res = max<int>(res, cs.size());
      }
    cout << res << endl;
  }
}
