#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[300];
  int x;
  scanf("%d", &x);
  gets(a);
  gets(a);
  int maxn = 0;
  int now = 0;
  for (int i = 0; i < x; i++) {
    if (a[i] >= 'A' && a[i] <= 'Z') now++;
    if (a[i] == ' ') now = 0;
    maxn = max(now, maxn);
  }
  printf("%d\n", maxn);
}
