#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 1e5 + 5;
const int MOD = 1e9 + 9;
const int INF = 1e9;
int n, tc, a[26], ans;
string s;
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  };
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    tc = 0;
    memset(a, -1, sizeof a);
    while (s[i] - 'a' >= 0) {
      a[s[i] - 'a']++;
      if (a[s[i] - 'a'] == 0) tc++;
      i++;
    }
    ans = max(tc, ans);
  }
  cout << ans << '\n';
  return 0;
}
