#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 1e5 + 1;
const long long INF = -1e17;
long long n;
long long ans, cnt, mx = 0;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  getline(cin, s);
  getline(cin, s);
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] > 64 and s[i] < 95) {
      ans++;
      mx = max(ans, mx);
    } else if (s[i] == ' ') {
      mx = max(ans, mx);
      ans = 0;
    }
  }
  cout << mx;
}
