# check_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
while True:
    try:
        s = input()
        count = 0
        for c in s:
#             if c in check_str:
            if c.isupper():#判断是否大写字母
#             if c >= 'A' and c <= 'Z':
                count += 1
        print(count)
    except:break