#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 1e5 + 10;
const int MAXM = 3e3 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
int A[MAXN];
int ct[30];
char S[MAXN];
int main() {
  int n, m, k, a, b, x, y;
  int sum = 0;
  int cnt = 0;
  int mx = 0;
  int mn = INF;
  scanf("%d", &n);
  scanf("%s", &S);
  int cur;
  for (int i = 0; S[i]; i++) {
    if (S[i] < 97) {
      cnt = 0;
      for (int j = 0; j < 26; j++) {
        if (ct[j]) cnt++;
      }
      mx = max(mx, cnt);
      for (int j = 0; j < 26; j++) ct[j] = 0;
    } else {
      ct[S[i] - 97]++;
    }
  }
  cnt = 0;
  for (int j = 0; j < 26; j++) {
    if (ct[j]) cnt++;
  }
  mx = max(mx, cnt);
  printf("%d", mx);
  return 0;
}
