#include <bits/stdc++.h>
using namespace std;
int main() {
  int curMax = 0, globMax = 0, n;
  string st;
  cin >> n;
  getchar();
  getline(cin, st);
  for (char ch : st) {
    if (ch == ' ')
      curMax = 0;
    else if (ch >= 'A' && ch <= 'Z')
      ++curMax;
    globMax = max(globMax, curMax);
  }
  cout << globMax;
}
