#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
void solve() {
  int n;
  string s;
  cin >> n >> s;
  set<char> s1;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    if ((int)(s[i] - 'a') < 26 && (int)(s[i] - 'a') >= 0) {
      s1.insert(s[i]);
    } else {
      s1.clear();
    }
    mx = max(mx, (int)s1.size());
  }
  cout << mx << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
