#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s;
  getline(cin, s);
  getline(cin, a);
  int b = 0, k = 0, x = 0, i, y, j;
  for (i = 0; i < 200; i++) {
    if (a[i] == '\0')
      break;
    else
      b++;
  }
  int c[200] = {0};
  for (j = 0, k = 0; j < b; j++) {
    char u = a[j];
    if (u >= 'A' && u <= 'Z') {
      c[k] += 1;
    }
    if (u == ' ') k++;
  }
  for (i = 0; i <= k; i++) {
    x = max(x, c[i]);
  }
  cout << x;
}
