// Try Codeforces
// author: Leonardone @ NEETSDKASU
import std.stdio, std.string, std.array, std.algorithm, std.ascii;

void main() {
    readln();
    auto xs = split(chomp(readln()));
    auto ys = xs.map!( (x) => x.count!( isUpper ) );
    writeln(ys.maxCount[0]);
}