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