#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string n;
  getline(cin, n);
  string s;
  getline(cin, s);
  int ans = 0, temp = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 'A' && s[i] <= 'Z')
      temp++;
    else if (s[i] == ' ') {
      ans = max(ans, temp);
      temp = 0;
    }
  }
  ans = max(ans, temp);
  cout << ans;
  return 0;
}
