import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int cnt = 0;
while (in.hasNextLine()) {
String s = in.nextLine();
for(int i = 0; i<s.length(); i++){
if(s.charAt(i)>='A' && s.charAt(i)<='Z'){
cnt++;
}
}
System.out.print(cnt);
}
}
}