#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, f(0), ans(0), maxi(0);
  string m;
  getline(cin, m);
  string ss, s = "";
  getline(cin, ss);
  s = ss + ' ';
  n = s.size();
  for (int i = 0; i < n; i++) {
    f = s[i];
    if (f >= 65 && f <= 90) {
      ans++;
    }
    if (f == 32) {
      maxi = max(maxi, ans);
      ans = 0;
    }
  }
  cout << maxi << "\n";
  return 0;
}
