import java.util.Scanner;

/**
 * HJ84 统计大写字母个数 - 简单
 */
public class HJ084 {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(count(s));
        }
        sc.close();
    }

    private static int count(String s) {
        int count = 0;
        char[] cs = s.toCharArray();
        for (char c : cs) {
            if (c >= 'A' && c <= 'Z') {
                count++;
            }
        }
        return count;
    }
}