#include<stdio.h>
int main(){
char data;
while(scanf("%c", &data) != EOF){
int all = 0;
if(data>='A' && data<='Z')all++;
while(data!='\n'){
scanf("%c", &data);
if(data>='A' && data<='Z')all++;
}
printf("%d\n", all);
}
}