#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, i, j;
  string s;
  cin >> n >> s;
  set<char> ch;
  int mx = 0;
  for (i = 0; i < n; i++) {
    if (s[i] >= 97 && s[i] <= 122) {
      ch.insert(s[i]);
      j = ch.size();
      mx = max(j, mx);
    } else
      ch.clear();
  }
  cout << mx;
}
