#include <bits/stdc++.h>
using namespace std;
char S[303];
int main() {
  int N;
  scanf("%d", &N);
  getchar();
  gets(S);
  int ans = 0, curr = 0;
  for (int i = 0; S[i] != '\0'; i++) {
    if (S[i] == ' ')
      curr = 0;
    else if (S[i] >= 'A' && S[i] <= 'Z')
      curr++;
    ans = max(ans, curr);
  }
  printf("%d\n", ans);
  return 0;
}
