# coding=utf-8
s = input()
n = 0
i = ord(s[n])
c = 0
while i != 46:
    if i >= 65 and i<= 90:
        c = c + 1
        n = n + 1
        i = ord(s[n])
         
    else:
        n = n + 1
        i = ord(s[n])
print(c)
/**************************************************************
	Problem: 1007
	User: admin
	Language: Python
	Result: Accepted
	Time:94 ms
	Memory:34480 kb
****************************************************************/