#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0;
  cin >> n;
  string a;
  cin >> a;
  int b[26] = {0}, i, Max = 0;
  for (i = 0; i < a.length(); i++) {
    if (a[i] >= 'a' && a[i] <= 'z' && b[a[i] - 'a'] == 0) {
      b[a[i] - 'a'] = 1;
      c++;
      Max = max(c, Max);
    } else if (a[i] >= 'A' && a[i] <= 'Z') {
      c = 0;
      memset(b, 0, sizeof(b));
    }
  }
  cout << Max;
}
