#include <iostream>
using namespace std;

int main() {
    string str;
    while (getline(cin, str) ) { // 注意 while 处理多个 case
        int cnt = 0;
        for(auto it : str){
            if(isupper(it)){
                cnt++;
            }
        }
        cout << cnt << endl;
    }
}
// 64 位输出请用 printf("%lld")