#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
const int INF = 1e9;
const ld PI = acos(-1.0);
const ld EPS = 1e-6;
bool isLower(char c) { return c >= 'a' && c <= 'z'; }
void solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (isLower(s[i])) {
      int j = i;
      set<char> c;
      while (j < n && isLower(s[j])) {
        c.insert(s[j]);
        j++;
      }
      ans = max(ans, (int)c.size());
      i = j;
    }
  }
  cout << ans << '\n';
  return;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int T;
  T = 1;
  while (T--) solve();
  return 0;
}
