#include <bits/stdc++.h>
using namespace std;
const int T = 3e3 + 3, N = 1e2 + 2;
vector<pair<int, pair<pair<int, int>, int>>> vc;
int ind[N];
int dp[T][N];
pair<int, int> par[T][N];
int main() {
  int n, ans = 0;
  string s;
  cin >> n >> s;
  set<char> st;
  for (auto &x : s) {
    if (x >= 'A' && x <= 'Z')
      st.clear();
    else
      st.insert(x);
    ans = max(ans, (int)st.size());
  }
  cout << ans;
  return 0;
}
