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