#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  cin.ignore();
  string s;
  getline(cin, s);
  int x = s.size();
  int count = 0, M = 0;
  for (int i = 0; i < x; i++) {
    if (s[i] >= 'A' && s[i] <= 'Z') {
      count++;
    }
    if (s[i] == ' ') {
      if (count > M) M = count;
      count = 0;
    }
  }
  M = max(M, count);
  cout << M << endl;
}
