#include <bits/stdc++.h>
using namespace std;
char s[201];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n + 1; i++) {
    s[i] = getchar();
  }
  int max = 0;
  int tmp = 0;
  for (int i = 1; i < n + 1; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      tmp++;
    } else if (s[i] == ' ') {
      if (max < tmp) max = tmp;
      tmp = 0;
    }
  }
  if (max < tmp) max = tmp;
  cout << max << endl;
  return 0;
}
