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