import java.io.*; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str;

    while((str = in.readLine()) != null){
           int total = 0;
        char[] ch = str.toCharArray();
        int len = ch.length;
        for(int i = 0;i < len;i++){
            if(ch[i] <= 'Z' && ch[i] >= 'A'){
                total ++;
            }
        }
        System.out.println(total);
        
    }
}

}