#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int main() {
  int tc, ca = 0;
  int n;
  cin >> n;
  string s;
  getchar();
  getline(cin, s);
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == ' ') {
      ans = max(ans, cnt);
      cnt = 0;
    } else if (s[i] >= 65 && s[i] <= 90)
      cnt++;
  }
  ans = max(ans, cnt);
  cout << ans << '\n';
  return 0;
}
