#include <bits/stdc++.h>
const int MaxN = 1000;
using namespace std;
char s[MaxN + 5];
int n;
int vis[200 + 5];
int main() {
  while (~scanf("%d", &n)) {
    scanf("%s", s + 1);
    int Max = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j++) {
        memset(vis, 0, sizeof(vis));
        int ans = 0;
        bool ok = 1;
        for (int k = i; k <= j; k++) {
          if (s[k] >= 'A' && s[k] <= 'Z')
            ok = 0;
          else {
            if (!vis[s[k]]) ans++, vis[s[k]] = 1;
          }
        }
        if (ok) Max = max(Max, ans);
      }
    }
    printf("%d\n", Max);
  }
}
