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