#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      int cur = 0;
      bool ok = true;
      for (int k = i; k <= j; ++k) {
        if (isupper(s[k])) {
          ok = false;
          break;
        }
        cur |= 1 << (s[k] - 'a');
      }
      if (ok) ans = max(ans, __builtin_popcount(cur));
    }
  }
  cout << ans << '\n';
}
