#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  string s;
  cin.ignore();
  getline(cin, s);
  int ct = 0, ans = 0;
  for (i = 0; i < s.size(); ++i) {
    if (s[i] == ' ') {
      ans = max(ans, ct);
      ct = 0;
    } else if (s[i] >= 'A' && s[i] <= 'Z') {
      ct++;
    }
    ans = max(ans, ct);
  }
  cout << ans << '\n';
}
