#include <bits/stdc++.h>
using namespace std;
int main() {
  char ss[202];
  int n, cnt = 0, ans = 0;
  scanf("%d", &n);
  getchar();
  gets(ss + 1);
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (ss[i] >= 'A' && ss[i] <= 'Z')
      cnt++;
    else if (ss[i] == ' ') {
      if (cnt > ans) ans = cnt;
      cnt = 0;
    }
  }
  if (cnt > ans) ans = cnt;
  cout << ans << endl;
  return 0;
}
