#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  char c[1];
  cin >> n;
  cin.getline(c, 1);
  char str[n + 1];
  cin.getline(str, n + 1);
  int vmax = 0, vol = 0;
  int i = 0;
  while (str[i] != '\0') {
    if (str[i] == ' ') vol = 0;
    if (str[i] <= 90 && str[i] >= 65) vol = vol + 1;
    if (vol >= vmax) vmax = vol;
    i++;
  }
  cout << vmax << endl;
  return 0;
}
