#include <bits/stdc++.h>
using namespace std;
int main() {
  char c;
  string s;
  int m = -99, n, i = 0, k = 0;
  cin >> n;
  cin >> c;
  getline(cin, s);
  s = c + s;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == ' ') {
      m = max(m, k);
      k = 0;
    } else if (s[i] >= 65 && s[i] <= 90)
      k++;
  }
  cout << max(m, k) << endl;
  return 0;
}
