#include <bits/stdc++.h>
using namespace std;
string s;
bool used[30];
int main() {
  int n, i, j, ans, cnt;
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> s;
  ans = 0;
  for (i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') continue;
    for (j = 0; j <= 28; j++) used[j] = false;
    used[s[i] - 'a'] = true;
    cnt = 1;
    for (j = i + 1; j < n; j++) {
      if (s[j] >= 'A' && s[j] <= 'Z') break;
      if (used[s[j] - 'a']) continue;
      used[s[j] - 'a'] = true;
      cnt++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
