#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin.ignore();
  getline(cin, s);
  int vol = 0;
  int sp = 0, maxm = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] >= 65 && s[i] <= 90) {
      vol++;
    }
    if (s[i] == ' ') {
      sp = 1;
      if (vol > maxm) {
        maxm = vol;
      }
      vol = 0;
    }
  }
  if (vol > maxm) {
    maxm = vol;
  }
  cout << maxm;
}
