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