#include <bits/stdc++.h>
char str[201];
int main() {
  int n, i;
  scanf("%d\n", &n);
  int max_v = 0;
  int v = 0;
  for (i = 0; i < n; i++) {
    char ch = getchar();
    if (ch >= 'A' && ch <= 'Z')
      v++;
    else if (ch == ' ') {
      if (v > max_v) max_v = v;
      v = 0;
    }
  }
  if (v > max_v) max_v = v;
  printf("%d\n", max_v);
  return 0;
}
