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