#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int c;
  int ans = 0, cur = 0;
  for (int i = 0; i <= n; i++) {
    c = getchar();
    if (c >= 'A' && c <= 'Z') cur++;
    ans = max(ans, cur);
    if (c == ' ') cur = 0;
  }
  cout << ans;
}
