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