#include <bits/stdc++.h>
int main() {
  int n, i, count = 0, t = 0;
  char s[1000];
  scanf("%d ", &n);
  gets(s);
  for (i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      count++;
      if (t <= count) t = count;
    } else if (s[i] == ' ') {
      count = 0;
    }
  }
  printf("%d", t);
  return 0;
}
