#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[220];
  int64_t len, pos, r = 0, maxi = 0;
  scanf("%I64d", &len);
  getchar();
  cin.getline(a, 210);
  a[len] = '#';
  for (int64_t i = 0; i <= len; i++) {
    if (a[i] >= 65 && a[i] <= 90) {
      r++;
    } else if (a[i] == 32 || a[i] == '#') {
      if (r > maxi) {
        maxi = r;
      }
      r = 0;
    }
  }
  printf("%I64d", maxi);
  return 0;
}
