#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, ans = INT_MIN;
  cin >> n;
  cin.ignore();
  string str, s;
  getline(cin, str);
  stringstream x(str);
  while (x >> s) {
    long long int i, c = 0;
    for (i = 0; s[i] != '\0'; i++)
      if (65 <= s[i] && 90 >= s[i]) c++;
    ans = max(ans, c);
  }
  cout << ans;
}
