#include <iostream>
using namespace std;

int main() {
    string str;
    while (getline(cin, str) ) { // 注意 while 处理多个 case
        int len = str.length();
        int cnt = 0;
        for(int i = 0; i < len; ++i){
            if(str[i] >= 'A' && str[i] <= 'Z'){
                cnt++;
            }
        }
        cout << cnt << endl;
    }
}
// 64 位输出请用 printf("%lld")