#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char s[205];
  scanf("%d", &n);
  getchar();
  gets(s);
  int ans = 0;
  int tmp = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') tmp++;
    if (s[i] == ' ') {
      ans = max(ans, tmp);
      tmp = 0;
    }
  }
  ans = max(tmp, ans);
  cout << ans;
}
